Table of contents
TOC
Collapse the table of content
Expand the table of content

Text.Trim

Owen Duncan|Last Updated: 10/5/2018
|
1 Contributor

About

Removes any occurrence of character pattern in trimChars from text.

Text.Trim(text as nullable text, optional trimChars as any) as nullable text  

Arguments

ArgumentDescription
textThe text to trim from.
optional trimCharsA character value or a list of character values.

Remarks

  • Characters are removed from the beginning and end of the text value.

  • If trimChars is not specified, then whitespace characters are trimmed. Whitespace characters are defined by the Power Query formula language specification document. trimChar is either a character value or a list of character values.

Examples

Text.Trim("xyAyz", "x") equals "yAyz"  

Where: x is removed.

Text.Trim("xyAyz", {"x","y"}) equals "Ayz"  

Where: x and y are removed.

Text.Trim("xyAyz", {"x","y","z"}) equals "A"  

Where:

  1. The first x, y and z pattern is removed.

  2. AND the second x, y and z pattern is removed

Text.Trim("xyAyz", "xy") equals error  
© 2018 Microsoft