startsWith

startsWith, function

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

Returns true if source starts with pattern.

Example

table T = with
  [| as Source, as Pattern |]
  [| "Hello world!", "Hello" |]
  [| "Hello world!", "hello" |]
  [| "Hello world!", "" |]
  [| "", "" |]

T.Result = startsWith(T.Source, T.Pattern)

show table "Starts with" with
  T.Source
  T.Pattern
  T.Result

This outputs the following table:

Source Pattern Result
Hello world! Hello true
Hello world! hello false
Hello world! true
true

Remarks

This function is case-sensitive. An empty pattern always returns true.

See also

User Contributed Notes
0 notes + add a note