Last index of

From Kolmafia
Revision as of 05:10, 22 May 2010 by imported>Bale
Jump to navigation Jump to search

Function Syntax

int last_index_of(string search ,string find )

  • search in the string to search in
  • find is the string you're trying to find

This function searches through the string search, looking for the string find. This function returns the position where find last occurs in search. This function returns a 0-indexed value, meaning that the first character of search counts as 0.

Code Sample

Returns the last instance of the phrase "la" in the following phrase.

last_index_of( "I'm not listening, la la la la" , "la" );

Would result in:

Returned: 28

See Also

index_of()

Special

If find does not occur in search, this function returns -1.