Description
The fn:substring-before function extracts all the characters of a string ($arg1 ) that appear before the first occurrence of another specified string ($arg2 ).
This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book. Arguments and Return TypeName | Type | Description |
$arg1 |
xs:string? |
the entire string |
$arg2 |
xs:string? |
the string that ends the substring |
$collation |
xs:string |
the collation to use to compare strings |
return value |
xs:string |
ExamplesXQuery Example | Results |
---|
substring-before('query', 'r') |
que |
substring-before('query', 'ery') |
qu |
substring-before('queryquery', 'ery') |
qu |
substring-before('query', 'query') |
zero-length string |
substring-before('query', 'x') |
zero-length string |
substring-before('query', '') |
zero-length string |
substring-before('query', ()) |
zero-length string |
See AlsoHistory |
Recommended Reading:
|