Text.EndsWith
Whether a text ends 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.EndsWith(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 ending 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 ends with it; null when the text is null.
Examples
A PDF file name
Text.EndsWith("invoice.pdf", ".pdf")
true
Ignoring case
Text.EndsWith("INVOICE.PDF", ".pdf", Comparer.OrdinalIgnoreCase)
true