ENDS_WITH()

All functions > STRING > ENDS_WITH()

Returns TRUE if a string ends with a specified suffix.

Signatures

Returns: TRUE if string ends with suffix, FALSE otherwise

ENDS_WITH(string: VARCHAR, suffix: VARCHAR) → BOOLEAN
sql
ParameterTypeRequiredDescription
stringVARCHARYesString to check
suffixVARCHARYesSuffix to look for

Notes

  • Case-sensitive comparison
  • Returns FALSE if suffix is longer than string
  • Returns TRUE if string and suffix are identical
  • An empty suffix is contained at the end of every string (including ''); a non-empty suffix never matches ''
  • If either argument is NULL the result is NULL (use NULL(VARCHAR); bare NULL fails inference)

Examples

FeatureQL
SELECT
    f1 := ENDS_WITH('Hello World', 'World'), -- Ends with suffix
    f2 := ENDS_WITH('Hello World', 'world'), -- Case-sensitive
    f3 := ENDS_WITH('test', 'test'), -- Exact match
    f4 := ENDS_WITH('ting', 'testing'), -- Suffix longer than string
    f5 := ENDS_WITH('100€', '€'), -- Unicode suffix
    f6 := ENDS_WITH('abc', ''), -- Empty suffix matches
    f7 := ENDS_WITH('', 'abc'), -- Non-empty suffix on empty string
    f8 := ENDS_WITH('x', NULL(VARCHAR)) -- NULL yields NULL
;
Result
f1 BOOLEANf2 BOOLEANf3 BOOLEANf4 BOOLEANf5 BOOLEANf6 BOOLEANf7 BOOLEANf8 BOOLEAN
truefalsetruefalsetruetruefalseNULL

Last update at: 2026/05/26 17:22:09