endsWith

endsWith, function

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

Returns true if source ends with the text pattern.

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

Remarks

endsWith is case-sensitive, and an empty pattern always returns true.

See also

User Contributed Notes
0 notes + add a note