Last index of: Difference between revisions
Jump to navigation
Jump to search
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={{#…' |
imported>Heeheehee m Fixing for correctness. |
||
Line 22: | Line 22: | ||
code1={{CodeSample| | code1={{CodeSample| | ||
title=Code Sample| | title=Code Sample| | ||
description= | description=Returns the last instance of the phrase "la" in the following phrase.| | ||
code= | code= | ||
<syntaxhighlight> | <syntaxhighlight> | ||
Line 29: | Line 29: | ||
moreinfo= | moreinfo= | ||
Would result in: | Would result in: | ||
<pre> | <pre>Returned: 28</pre> | ||
Returned: 28 | }}| | ||
</pre>}}| | |||
see_also={{SeeAlso|index_of}}| | see_also={{SeeAlso|index_of}}| | ||
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.| | ||
}} | }} |
Revision as of 05:30, 23 March 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.