functx:substring-before-last

The substring before the last occurrence of a delimiter

Description

The functx:substring-before-last function returns the part of $arg that appears before the last occurrence of $delim. If $arg does not contain $delim, a zero-length string is returned.

Parameters

Description

arg:string()

the string to substring

delim:string()

the delimiter

Examples

XPath

Results

functx:substring-before-last(‘abc-def-ghi’, ‘-‘)

abc-def

functx:substring-before-last(‘abcd-abcd’, ‘ab’)

abcd-

functx:substring-before-last(‘abcd-abcd’, ‘x’)

zero-length string

See Also