endsWith
endsWith, function
def const pure endsWith(source: text, pattern: text): boolean
Returns true
if the source
ends with an occurrence of the pattern
.
source
: The text in whichpattern
should be looked forpattern
: The text to look for insidesource
Example
table T = with
[| as Source , as Pattern |]
[| "Hello world!" , "world!" |]
[| "Hello world!" , "WORLD!" |]
[| "Hello world!" , "" |]
[| "" , "" |]
T.Result = endsWith(T.Source, T.Pattern)
show table "T" with
T.Source
T.Pattern
T.Result
This outputs the following table :
Source | Pattern | Result |
---|---|---|
Hello world! | world! | true |
Hello world! | WORLD! | false |
Hello world! | true | |
true |
Remarks
This function is case-sensitive, as illustrated hereinabove.
Using endsWith
with an empty pattern will always return true
.