xf:ends-with

Determines if the $string-var1 ends with string specified in $string-var2.

Signatures

xf:ends-with(xs:string? $string-var1, xs:string? $string-var2) —> xs:boolean?

Arguments

Data Type
Argument
Description

xs:string?

$string-var1

Represents the string to compare against.

xs:string?

$string-var2

Compare this string against $string-var1 to see if $string-var1 ends in this string.

Returns

Returns the boolean value of true, if $string-var1 ends with a string that is equal to $string-var2.

Returns the boolean value of false, if $string-var1 does not end with a string that is equal to $string-var2.

Returns the boolean value true, if $string-var2 is a zero-length string ("").

Returns the boolean value false, if $string-var1 is a zero-length string ("") and $string-var2 is not a zero-length string.

If the value of $string-var1 or $string-var2 is the empty sequence, the empty sequence is returned. The empty sequence is a sequence containing zero items (), which is similar to null in SQL.

Examples

This Query . . .
Generates This Result . . .

<r>{xf:ends-with("honeymoon", "moon")}</r>

<r>true</r>

<r>{xf:ends-with("honeymoon", "honey")}</r>

<r>false</r>

<r>{xf:ends-with("honeymoon", "hat")}</r>

<r>false</r>

<r>{xf:ends-with("honeymoon", "")}</r>

<r>true</r>

<r>{xf:ends-with("", "moon")}</r>

<r>false</r>

<r>{xf:ends-with("moon", ())}</r>

<r/>

Related Topics

W3C ends-with function description.