Functions
M Text Functions
Text Functions
M text functions like Text.Combine manipulate strings.
Introduction to M Text Functions
M text functions are a powerful set of tools for manipulating strings within the M programming language, often used in data transformation and manipulation tasks. These functions enable you to perform a variety of operations such as combining, splitting, and modifying text strings efficiently.
Using Text.Combine
The Text.Combine
function is used to concatenate a list of text values into a single string. You can specify a separator to insert between each text value. This is particularly useful when you need to join strings from records or tables.
In this example, we have a list of strings: {"Hello", "World", "M"}
. By using Text.Combine
with a separator of ", ", the resulting string is "Hello, World, M"
.
Splitting Text with Text.Split
The Text.Split
function allows you to divide a text string into a list of substrings based on a specified separator. This is particularly useful for breaking down CSV data or similar formats.
In this example, the string "apple,banana,orange"
is split into a list: {"apple", "banana", "orange"}
, using the comma as a separator.
Converting Text with Text.Upper and Text.Lower
The functions Text.Upper
and Text.Lower
are used to convert text to uppercase and lowercase, respectively. These functions are useful for standardizing text data.
In this example, the text "Power Query"
is converted to "POWER QUERY"
using Text.Upper
and "power query"
using Text.Lower
.
Trimming Text with Text.Trim
The Text.Trim
function removes leading and trailing whitespace from a string. This is essential for cleaning up data before processing.
In this example, the string " Hello World "
is trimmed to "Hello World"
, removing any unnecessary spaces.
Functions
- Previous
- Function Invocation
- Next
- Number Functions