home contribute faq download

FunctX XQuery Functions

functx:index-of-string-last

The last position of a substring

Google
Webdatypic.com

Description

The functx:index-of-string-last function returns an integer representing the last position of $substring within $arg. If $arg does not contain $substring, the empty sequence is returned.

Arguments and Return Type

NameTypeDescription
$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-last
  ( $arg as xs:string? ,
    $substring as xs:string )  as xs:integer? {

  functx:index-of-string($arg, $substring)[last()]
 } ;

Examples

XQuery ExampleResults
functx:index-of-string-last(
   'abcdabcdabcd','abc')
9
functx:index-of-string-last(
   'abcd','abc')
1
functx:index-of-string-last(
   'xxx','abc')
()

Depends On

functx:index-of-stringThe position(s) of a substring

See Also

functx:index-of-stringThe position(s) of a substring
functx:index-of-string-firstThe first position of a substring
fn:containsWhether one string contains another

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, https://www.datypic.com
Datypic XQuery Services

Recommended Reading:

XQuery