Редактиране

Споделяне чрез


ENDSWITH (NoSQL query)

APPLIES TO: NoSQL

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

Syntax

ENDSWITH(<string_expr_1>, <string_expr_2> [, <bool_expr>])

Arguments

Description
string_expr_1 A string expression.
string_expr_2 A string expression to be compared to the end of string_expr_1.
bool_expr (Optional) Optional value for ignoring case. When set to true, ENDSWITH does a case-insensitive search. When unspecified, this default value is false.

Return types

Returns a boolean expression.

Examples

The following example checks if the string abc ends with b or bC.

SELECT VALUE {
    endsWithWrongSuffix: ENDSWITH("AdventureWorks", "Adventure"),
    endsWithCorrectSuffix: ENDSWITH("AdventureWorks", "Works"),
    endsWithSuffixWrongCase: ENDSWITH("AdventureWorks", "works"),
    endsWithSuffixCaseInsensitive: ENDSWITH("AdventureWorks", "works", true)
}
[
  {
    "endsWithWrongSuffix": false,
    "endsWithCorrectSuffix": true,
    "endsWithSuffixWrongCase": false,
    "endsWithSuffixCaseInsensitive": true
  }
]

Remarks

  • This function performs a full index scan.