The substring-before function returns a string that is the part of a given string before a given substring.
substring-before( haystack, needle )
haystackThe string to be evaluated. Part of this string will be returned.
needleThe substring to search for. Everything before the first occurrence of needle in haystack will be returned.
A string.
| XPath Example | Output |
|---|---|
substring-before('aa-bb','-') | aa |
substring-before('aa-bb','a') | (empty string) |
substring-before('aa-bb','b') | aa- |
substring-before('aa-bb','q') | (empty string) |
Supported.