Text.StartsWith
Whether a text begins with a given piece of text.
Group: Text and characters. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Text.StartsWith(text as nullable text, substring as text, optional comparer as nullable function) as nullable logical
| Parameter | Type | Description |
|---|---|---|
text | nullable text | The text to check; null gives null. |
substring | text | The beginning to look for. |
comparer | nullable function optional | How to compare: Comparer.Ordinal (the default, case counts) or Comparer.OrdinalIgnoreCase. |
Returns
nullable logical. true when the text starts with it; null when the text is null.
Examples
A Norwegian postcode
Text.StartsWith("NO-0150", "NO")
true
Ignoring case
Text.StartsWith("no-0150", "NO", Comparer.OrdinalIgnoreCase)
true