Splitter.SplitTextByRanges is a Power Query M function that splits text into a list based on specified offsets and lengths. The function returns a list of text segments after applying the range-based splitting.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Splitter.SplitTextByRanges(
ranges as list,
optional startAtEnd as nullable logical,
) as function
Description
Returns a function that splits text into a list of text according to the specified offsets and lengths. A null length indicates that all remaining input should be included.
Examples
Split the input by the specified position and length pairs, starting from the beginning of the input. Note that the ranges in this example overlap.
// Output: {"code", "delimiter"}
Splitter.SplitTextByRanges( {{0, 4}, {2, 10}} )( "codelimiter" )
Split the input by the specified position and length pairs, starting from the end of the input.
// Output: {"WA", "98052"}
let
startAtEnd = true
in
Splitter.SplitTextByRanges( {{0, 5}, {6, 2}}, startAtEnd )( "RedmondWA?98052" )
Split the input into a fixed-length postal code followed by a variable-length city name.
// Output: {"98052", "Redmond"}
Splitter.SplitTextByRanges( {{0, 5}, {5, null}} )( "98052Redmond" )
Used by
While you can use the Splitter.SplitTextByRanges function by itself, it also works together with:
Related functions
Other functions related to Splitter.SplitTextByRanges are:
- Splitter.SplitByNothing
- Splitter.SplitTextByAnyDelimiter
- Splitter.SplitTextByCharacterTransition
- Splitter.SplitTextByDelimiter
- Splitter.SplitTextByEachDelimiter
- Splitter.SplitTextByLengths
- Splitter.SplitTextByPositions
- Splitter.SplitTextByRepeatedLengths
- Splitter.SplitTextByWhitespace
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy