Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
APPLIES TO: 
NoSQL
Returns a boolean indicating whether the first string expression contains the second string expression.
Syntax
CONTAINS(<string_expr_1>, <string_expr_2> [, <bool_expr>])  
Arguments
| Description | |
|---|---|
| string_expr_1 | The first string to search. | 
| string_expr_2 | The second string to find. | 
| bool_expr(Optional) | Optional boolean value for ignoring case. When set to true,CONTAINSperforms a case-insensitive search. Whenunspecified, this value defaults tofalse. | 
Return types
Returns a boolean expression.
Examples
The following example checks if various static substrings exist in a string.
SELECT VALUE {
    containsPrefix: CONTAINS("AdventureWorks", "Adventure"), 
    containsSuffix: CONTAINS("AdventureWorks", "Works"),
    containsWrongCase: CONTAINS("AdventureWorks", "adventure"), 
    containsWrongCaseValidateCase: CONTAINS("AdventureWorks", "adventure", false), 
    containsWrongCaseIgnoreCase: CONTAINS("AdventureWorks", "works", true),
    containsMismatch: CONTAINS("AdventureWorks", "Contoso")
}
[
  {
    "containsPrefix": true,
    "containsSuffix": true,
    "containsWrongCase": false,
    "containsWrongCaseValidateCase": false,
    "containsWrongCaseIgnoreCase": true,
    "containsMismatch": false
  }
]
Remarks
- This function performs a full scan.