# xf:contains

Determines if $string-var1 contains the string specified in $string-var2.

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

### Signatures

xf:contains(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 this string is contained anywhere in $string-var1.

### Returns

Returns the boolean value of true, if $string-var1 contains $string-var2.

Returns the boolean value of false, if $string-var1 does not contain $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.

### Examples

This Query . . . | Generates This Result . . .
--- | ---
<r>{xf:contains("supercalifragilistic", "fragil")}</r> | <r>true</r>
<r>{xf:contains("supercalifragilistic", "honey")}</r> | <r>false</r>
<r>{xf:contains("supercalifragilistic", "")}</r> | <r>true</r>
<r>{xf:contains("", "honey")}</r> | <r>false</r>
<r>{xf:contains("honey", ())}</r> | <r/>

Related Topics

W3C contains function description.