Text.Trim
A text without the white space, or other characters you name, at its start and end.
Group: Text and characters. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Text.Trim(text as nullable text, optional trim as any) as nullable text
| Parameter | Type | Description |
|---|---|---|
text | nullable text | The text to work on; null gives null. |
trim | any optional | The characters to take away: one character as text, or a list of such. Left out, white space (spaces, tabs, line breaks). |
Returns
nullable text. The text with the characters taken off both ends; what is inside stays.
Examples
Spaces around a name
Text.Trim(" Oslo ")
"Oslo"
Zeros at both ends
Text.Trim("00123400", "0")
"1234"
Several characters
Text.Trim("*-Oslo-*", {"*", "-"})
"Oslo"