.. _substring-before: ================ substring-before ================ The substring before the first occurrence of a delimiter 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). .. list-table:: :widths: 40 60 :header-rows: 1 * - **Parameters** - **Description** * - arg1:string() - the entire string * - arg2:string() - the string that ends the substring * - collation:string() - the collation to use to compare strings Examples ~~~~~~~~ .. list-table:: :widths: 50 50 :header-rows: 1 * - **XPath** - **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 Also ~~~~~~~~ .. toctree:: :titlesonly: :glob: * :ref:`functx_substring-before-last`. * :ref:`functx_substring-before-if-contains`. * :ref:`substring`. * :ref:`substring-after`.