functx:substring-before-if-contains
Performs substring-before, returning the entire string if it does not contain the delimiter
Description
The functx:substring-before-if-contains function performs substring-before, returning the entire string if it does not contain the delimiter. It differs from the built-in fn:substring-before function, which returns a zero-length string if the delimiter is not found.
Parameters |
Description |
---|---|
arg:string() |
the string to substring |
delim:string() |
the delimiter |
Examples
XPath |
Results |
---|---|
functx:substring-before-if-contains(‘abcd’,’c’) |
ab |
functx:substring-before-if-contains(‘abcd’,’x’) |
abcd |