Check whether one string contains another.
fn:contains(string $string, string? $searchString) => boolean
fn:contains(string $string, string? $searchString, string $collation) => boolean
This function checks whether the value of $string
contains
the value of $searchString
anywhere. It returns true
if it is found and false
if not. There are some special cases in
which this function returns the following values:
true |
the value of $string is a
string of length zero
|
false |
the value of $searchString
is a string of length zero
|
It is an error if either string value is an empty sequence.
$string |
string value |
---|---|
$searchString |
string value that is searched for in |
$collation |
optional valid collation string literal |
Is "ino" in "Tamino"?
contains("Tamino", "ino")
The function returns true
, since
"ino" is obviously contained in
"Tamino".
Is the empty string part of another empty string?
contains("", "")
The function returns true
.
The following construct(s) refer to this construct: