ends-with function

The fn:ends-with function determines whether a string ends with a specific substring. The search string is matched using the default collation.

Syntax

Read syntax diagramSkip visual syntax diagramfn:ends-with( string, substring)
string
The string to search for substring.

string has the xs:string data type, or is an empty sequence. If string is an empty sequence, string is set to a string of length 0.

substring
The substring to search for at the end of string.

substring has the xs:string data type, or is an empty sequence.

Limitation of length

The length of substring is limited to 32000 bytes.

Returned value

The returned value is the xs:boolean value true if either of the following conditions is satisfied:
  • substring occurs at the end of string.
  • substring is an empty sequence or a string of length zero.
Otherwise, the returned value is false.

Example

The following function determines whether the string 'Test literal' ends with the string 'literal'.
fn:ends-with('Test literal','literal')

The returned value is true.