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
| Parameter | Type | Required | Description |
|---|---|---|---|
string | VARCHAR | Yes | String to check |
suffix | VARCHAR | Yes | Suffix 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); bareNULLfails 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 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN | f4 BOOLEAN | f5 BOOLEAN | f6 BOOLEAN | f7 BOOLEAN | f8 BOOLEAN |
|---|---|---|---|---|---|---|---|
| true | false | true | false | true | true | false | NULL |
On this page