ENDSWITH
Description
The ENDSWITH
function is used to determine whether a string or binary expression ends with another specified string or binary expression. If the condition is met, it returns the Boolean value TRUE
; otherwise, it returns FALSE
. This function supports both string and binary data and is applicable to string processing and pattern matching scenarios.
Syntax
Parameters
expr
: A string or binary expression representing the target data to be checked.endExpr
: A string or binary expression representing the ending pattern for comparison.
Return Value
- The return value is of Boolean type (
TRUE
orFALSE
). - If either
expr
orendExpr
isNULL
, the function returnsNULL
. - If
endExpr
is an empty string or empty binary data, the function returnsTRUE
.
Examples
Example 1: String pattern matching
Example 2: Case sensitivity
Example 3: Including NULL values
Example 4: Empty string