functx:index-of-string

The position(s) of a substring

Description

The functx:index-of-string function returns one or more integers representing the position of a $substring within $arg. Overlapping substrings are not counted. If $arg does not contain $substring, the empty sequence is returned.

Parameters

Description

arg:string()

the string

substring:string()

the substring to find

Examples

XPath

Results

functx:index-of-string(‘abcdabcdabcd’,’abc’)

(1, 5, 9)

functx:index-of-string(‘abcd’,’abc’)

1

functx:index-of-string(‘xxx’,’abc’)

()

See Also