Navigation :
startsWith
startsWith, function
def const dash pure startsWith(source: text, pattern: text): boolean
Returns true if source starts with pattern.
source: the text to test.
pattern: the prefix to match.
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 |
This function is case-sensitive. An empty pattern always returns true.
See also