Navigation :
endsWith
endsWith, function
def const dash pure endsWith(source: text, pattern: text): boolean
Returns true if source ends with the text pattern.
source: the text to test.
pattern: the suffix to match.
Examples
table T = with
[| as Source, as Pattern |]
[| "Hello world!", "world!" |]
[| "Hello world!", "WORLD!" |]
[| "Hello world!", "" |]
[| "", "" |]
T.Result = endsWith(T.Source, T.Pattern)
show table "Matches" with
T.Source
T.Pattern
T.Result
This produces the following table:
| Source |
Pattern |
Result |
| Hello world! |
world! |
true |
| Hello world! |
WORLD! |
false |
| Hello world! |
|
true |
|
|
true |
endsWith is case-sensitive, and an empty pattern always returns true.
See also