The string-lastindexof() function
Smartsite 7.2 - ...
The string-lastindexof() extension function returns the zero-based index of the last occurrence of the specified character or string in this string, or -1 when the character or string is not found in this instance.
XML | Copy Code |
---|---|
int exf:string-lastindexof(arg1, string value, int startIndex) |
Parameters:
- arg1: a node reference or string literal.
- value: the string to seek.
- startIndex (optional): the search starting position.
Example
XML | Copy Code |
---|---|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:exf="http://smartsite.nl/namespaces/xforms/1.0"> <head> <title>Example</title> <xf:model> <xf:instance> <data xmlns=""> <indexof>string-indexof(string value, int startIndex)</indexof> </data> </xf:instance> </xf:model> </head> <body> <xf:group ref="/data" appearance="full"> <xf:label /> <xf:output value="exf:string-lastindexof(indexof, 'i')" /> <xf:output value="exf:string-lastindexof(indexof, 'i', 10)" /> <xf:output value="exf:string-lastindexof(indexof, 'I')" /> <xf:output value="exf:string-lastindexof(indexof, 'I', 10)" /> </xf:group> </body> </html> |
The result will be:
29
7
38
-1
Namespace
This function is available within the Smartsite XForms namespace (http://smartsite.nl/namespaces/xforms/1.0).