indexOf

Returns the first index position of a specified element within a list, or -1 if the list does not contain the specified element.

Syntax:

$[ScriptVariable]::indexOf(String str)

Parameters:

str (String): the list element to search for within the list.

Example:

The following example illustrates the syntax for the indexOf list method:

$recipients = "Engineering Group"

$recipients::add("Building 14")

$recipients::add("Winston Smythe")

$position = $recipients::indexOf("Winston Smythe")

print($position)

Output:

2