contains

Whether one string contains another

Description

The fn:contains function returns true if $arg1 contains the characters of $arg2 anywhere in its contents, including at the beginning or end.

Parameters

Description

arg1:string()

the string to test

arg2:string()

the substring to test for

collation:string()

the collation to use for sorting

Examples

XPath

Results

contains(‘query’, ‘e’)

true

contains(‘query’, ‘ery’)

true

contains(‘query’, ‘query’)

true

contains(‘query’, ‘x’)

false

contains(‘query’, ‘’)

true

contains(‘query’, ())

true

contains( (), ‘q’)

false

See Also