Description
The functx:substring-after-last function returns the part of $arg that appears after the last occurrence of $delim. If $arg does not contain $delim, the entire $arg is returned. If $arg is the empty sequence, a zero-length string is returned.
Arguments and Return Type| Name | Type | Description |
$arg |
xs:string? |
the string to substring |
$delim |
xs:string |
the delimiter |
| return value |
xs:string |
XQuery Function Declaration| See XSLT definition. | | XQuery Syntax for July 2004 - January 2007 (1.0): |
|---|
declare namespace functx = "http://www.functx.com";
declare function functx:substring-after-last
( $arg as xs:string? ,
$delim as xs:string ) as xs:string {
replace ($arg,concat('^.*',functx:escape-for-regex($delim)),'')
} ; | | XQuery Syntax for May 2003: |
|---|
declare namespace functx = "http://www.functx.com"
define function substring-after-last
( $arg as xs:string? ,
$delim as xs:string ) as xs:string {
fn:replace ($arg,fn:concat('^.*',functx:escape-for-regex($delim)),'')
} |
Examples| XQuery Example | Results |
|---|
functx:substring-after-last('abc-def-ghi', '-')
|
ghi
|
functx:substring-after-last('abcd-abcd', 'ab')
|
cd
|
functx:substring-after-last('abcd-abcd', 'x')
|
abcd-abcd
|
Depends OnSee AlsoHistory |
|