Last index of: Difference between revisions
Jump to navigation
Jump to search
imported>Heeheehee m Fixing for correctness. |
imported>Bale mNo edit summary |
||
Line 5: | Line 5: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 35: | Line 34: | ||
special=If {{pspan|find}} does not occur in {{pspan|search}}, this function returns -1.| | special=If {{pspan|find}} does not occur in {{pspan|search}}, this function returns -1.| | ||
}} | }} | ||
[[Category:String Handling Routines]] |
Revision as of 05:10, 22 May 2010
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
Special
If find does not occur in search, this function returns -1.