fn:ends-with

Check whether a string ends with another string.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

fn:ends-with(string $term, string? $searchString) => boolean
fn:ends-with(string $term, string? $searchString, string $collation) => boolean

Description

This function checks whether the value of $string ends with the value of $searchString according to the collation used. It returns true if it is found and false if not. If the value of $string or $searchString is the empty sequence, the function returns the empty sequence. If the value of $searchString is the empty string, then the function returns "true". If the value of $string is the empty string and the value of $searchString is a non-empty string, the function returns "false".

You can use an optional collation argument.

Arguments

$term

string value

$searchString

string value that is searched for in $string

$collation

optional valid collation string literal

Example

  • Does "Tamino" end with "ino" ?

    ends-with("Tamino", "ino")

    The function returns true, since "ino" obviously appears at the end of "Tamino".