Splitter.SplitTextByLengths is a Power Query M function that splits text into a list based on the specified lengths. The function returns a list of text segments after applying the length-based splitting.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Splitter.SplitTextByLengths(
lengths as list,
optional startAtEnd as nullable logical,
) as function
Description
Returns a function that splits text into a list of text by each specified length.
Examples
Split the input into the first two characters followed by the next three, starting from the beginning of the input.
// Output: {"AB", "123"}
Splitter.SplitTextByLengths( {2, 3} )( "AB123" )
Split the input into the first three characters followed by the next two, starting from the end of the input.
// Output: {"WA", "98052"}
let
startAtEnd = true
in
Splitter.SplitTextByLengths( {5, 2}, startAtEnd )( "RedmondWA98052" )
Used by
While you can use the Splitter.SplitTextByLengths function by itself, it also works together with:
Related functions
Other functions related to Splitter.SplitTextByLengths are:
- Splitter.SplitByNothing
- Splitter.SplitTextByAnyDelimiter
- Splitter.SplitTextByCharacterTransition
- Splitter.SplitTextByDelimiter
- Splitter.SplitTextByEachDelimiter
- Splitter.SplitTextByPositions
- Splitter.SplitTextByRanges
- Splitter.SplitTextByRepeatedLengths
- Splitter.SplitTextByWhitespace
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy