endsWith

endsWith, function

def const pure endsWith(source: text, pattern: text): boolean

Returns true if the source ends with an occurrence of the pattern.

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.

See also

User Contributed Notes
0 notes + add a note