ENDSWITH (Azure Cosmos DB)

APPLIES TO: NoSQL

Returns a Boolean indicating whether the first string expression ends with the second.

Syntax

ENDSWITH(<str_expr1>, <str_expr2> [, <bool_expr>])

Arguments

str_expr1
Is a string expression.

str_expr2
Is a string expression to be compared to the end of str_expr1.

bool_expr Optional value for ignoring case. When set to true, ENDSWITH 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" ends with "b" and "bC".

SELECT ENDSWITH("abc", "b", false) AS e1, ENDSWITH("abc", "bC", false) AS e2, ENDSWITH("abc", "bC", true) AS e3

Here is the result set.

[
    {
        "e1": false,
        "e2": false,
        "e3": true
    }
]

Remarks

Learn about how this string system function uses the index.

Next steps