substring-after function
The fn:substring-after function returns a substring that occurs in a string after the end of the first occurrence of a specific search string. The search string is matched using the default collation.
Syntax
- source-string
- The string from which the substring is retrieved.
source-string has the xs:string data type, or is an empty sequence. If source-string is the empty sequence, source-string is set to a string of length 0.
- search-string
- The string whose first occurrence in source-string is to
be searched for.
search-string has the xs:string data type, or is an empty sequence.
- Limitation of length
The length of search-string is limited to 32000 bytes.
Returned value
If source-string is
not the empty sequence or a string of length 0:
- Suppose that the length of source-string is n, and m<n. If search-string is found in source-string, and the end of the first occurrence of search-string in source-string is at position m, the returned value is the substring that begins at position m+1, and ends at position n of source-string.
- Suppose that the length of source-string is n. If search-string is found in source-string, and the end of the first occurrence of search-string in source-string is at position n, the returned value is a string of length 0.
- If search-string is the empty string or a string of length 0, the returned value is source-string.
- If search-string is not found in source-string, the returned value is a string of length 0.
If source-string is the empty sequence or a string of length 0, the returned value is a string of length 0.
Example
The following function finds the characters after 'ABC' in string to 'DEFABCD' using the default collation.
fn:substring-after('DEFABCD', 'ABC')The returned value is 'D'.
