.. _functx_substring-before-if-contains: =================================== 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. .. list-table:: :widths: 40 60 :header-rows: 1 * - **Parameters** - **Description** * - arg:string() - the string to substring * - delim:string() - the delimiter Examples ~~~~~~~~ .. list-table:: :widths: 50 50 :header-rows: 1 * - **XPath** - **Results** * - functx:substring-before-if-contains('abcd','c') - ab * - functx:substring-before-if-contains('abcd','x') - abcd See Also ~~~~~~~~ .. toctree:: :titlesonly: :glob: * :ref:`substring-before`. * :ref:`functx_substring-before-last`. * :ref:`functx_substring-after-if-contains`.