lastIndexOf: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Verisimilar (talk | contribs) m (Applied Template:MacroFunction) |
||
Line 1: | Line 1: | ||
= | {{MacroFunction | ||
|name=lastIndexOf | |||
|description= | |||
Finds the index in a string of the last occurrence of a substring in a string. If the substring does not occur in the string then -1 is returned. The index for the string starts at 0. | Finds the index in a string of the last occurrence of a substring in a string. If the substring does not occur in the string then -1 is returned. The index for the string starts at 0. | ||
|usage= | |||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[h: ind = lastIndexOf(str, substr)] | [h: ind = lastIndexOf(str, substr)] | ||
</source> | </source> | ||
|example= | |||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[lastIndexOf("abcde", "c")] | [lastIndexOf("abcde", "c")] | ||
Line 18: | Line 19: | ||
</source> | </source> | ||
Returns -1 | Returns -1 | ||
}} | |||
[[Category:String Function]] |
Revision as of 02:31, 9 March 2009
lastIndexOf() Function
Finds the index in a string of the last occurrence of a substring in a string. If the substring does not occur in the string then -1 is returned. The index for the string starts at 0.
Usage
[h: ind = lastIndexOf(str, substr)]
Example
[lastIndexOf("abcde", "c")]
Returns 2
[lastIndexOf("abcde", "z")]