Last index of

From Kolmafia
Revision as of 18:36, 11 March 2010 by imported>StDoodle (Created page with '{{ #vardefine:name|last_index_of}}{{ #vardefine:return_type|int}}{{ FunctionPage| name={{#var:name}}| function_category=String Handling Routines| function1={{Function| name={{#…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

Searches for the letter "c" in the lowercase alphabet.

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.