indexOf

Returns the position of a value contained within another object. Depending on the target object, the meaning of ‘indexOf’ will be different and the parameters expected will differ.

Parameters:

No. Type Comments
1 Object of type string or list< T > Containing object
2 Value being searched to get index Depends on the type of the 1st argument to indexOf

Returns: int - Value >= 0 indicating position. Or -1 if the value does not exist.

Usages:

  • contains( v:list<T>, value : T ) : boolean
  • contains( v:set<T>, value : T ) : boolean
  • contains( v:string, entry:string ) : boolean