Returns the index inside of the string of tha last appearance of the specified substring.
The last ocurrence of an empty string "" this is considered to occur in the value of the index.length ().
1 string.lastIndexOf
<string.lastIndexOf>
<text /> !
<subtext /> !
</string.lastIndexOf>
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Etext | string | ||||
Esubtext | string |
Returns | |
---|---|
Type | Description |
integer | Returns the index of the last appearance of the specified substring or -1 if there is not this accurence. |
Exceptions
requires 2 arguments, received: ...
The 2 entry parameters has not been specified.
See also
http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#lastIndexOf(java.lang.String)
Remarks
The character position indexes start counting from 0 and not from 1. If the substring of the second argument in the string or text of the first argument is not found, the script will return -1 as result. However, if the value of the second argument is null, the script will return as result the position 0.
Visualize the initial position of the last of the argument 2 which can have the argument1.
<xsql-script name='string_lastIndexOf'> <body> <set name='a'>This IS a STRING OF characters, a STRING.</set> <set name='b'>STRING</set> <set name='c'>STRING</set> <println><string.lastIndexOf><a /><b /></string.lastIndexOf></println> <println><string.lastIndexOf><a /><c /></string.lastIndexOf></println> </body> </xsql-script>
Returns:
-1 38