Description
The functx:index-of-string-first function returns an integer representing the first position of $substring within $arg. If $arg does not contain $substring, the empty sequence is returned.
Arguments and Return Type| Name | Type | Description |
$arg |
xs:string? |
the string |
$substring |
xs:string |
the substring to find |
| return value |
xs:integer? |
XQuery Function Declaration| See XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:index-of-string-first
( $arg as xs:string? ,
$substring as xs:string ) as xs:integer? {
if (contains($arg, $substring))
then string-length(substring-before($arg, $substring))+1
else ()
} ; |
Examples| XQuery Example | Results |
|---|
functx:index-of-string-first(
'abcdabcdabcd','abc') |
1 |
functx:index-of-string-first(
'abcd','abc') |
1 |
functx:index-of-string-first(
'xxx','abc') |
() |
See AlsoHistory |
Recommended Reading: 
|