home contribute faq download

FunctX XQuery Functions

fn:contains

Whether one string contains another

Google
Webxqueryfunctions.com

Description

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

This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book.

Arguments and Return Type

NameTypeDescription
$arg1 xs:string? the string to test
$arg2 xs:string? the substring to test for
$collation xs:string the collation to use for sorting
return value xs:boolean

Examples

XQuery ExampleResults
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

functx:contains-wordWhether one string contains another, as a separate word
functx:contains-case-insensitiveWhether one string contains another, without regard to case
functx:contains-any-ofWhether a string contains any of a sequence of strings
functx:index-of-stringThe position(s) of a substring
functx:index-of-string-firstThe first position of a substring
functx:index-of-string-lastThe last position of a substring
fn:starts-withWhether one string starts with another
fn:ends-withWhether one string ends with another
fn:matchesWhether a string matches a regular expression

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26W3C, XQuery 1.0 and XPath 2.0 Functions and Operators, http://www.w3.org/TR/xpath-functions/
Need XQuery Help?
D A T Y P I C
Training | Consulting | Development

XQuery by Priscilla WalmsleyGet the book!
XQuery by Priscilla Walmsley