lastIndexOf: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function lastIndexOf== 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 th...)
 
No edit summary
Line 5: Line 5:
===Usage===
===Usage===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: ind = lastIndexOf(string, substring)]
[h: ind = lastIndexOf(str, substr)]
</source>
</source>



Revision as of 16:08, 6 December 2008

Function lastIndexOf

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")]

Returns -1