STARTSWITH (Azure Cosmos DB)
APPLIES TO:
NoSQL
Returns a Boolean indicating whether the first string expression starts with the second.
Syntax
STARTSWITH(<str_expr1>, <str_expr2> [, <bool_expr>])
Arguments
str_expr1
Is a string expression.
str_expr2
Is a string expression to be compared to the beginning of str_expr1.
bool_expr Optional value for ignoring case. When set to true, STARTSWITH will do a case-insensitive search. When unspecified, this value is false.
Return types
Returns a Boolean expression.
Examples
The following example checks if the string "abc" begins with "b" and "A".
SELECT STARTSWITH("abc", "b", false) AS s1, STARTSWITH("abc", "A", false) AS s2, STARTSWITH("abc", "A", true) AS s3
Here is the result set.
[
{
"s1": false,
"s2": false,
"s3": true
}
]
Remarks
Learn about how this string system function uses the index.
Next steps
Feedback
Submit and view feedback for