Splitter.SplitTextByRanges

This function returns a result that divides a given text into smaller sections based on specified starting points and lengths. If a length is set to zero, the remainder of the input will be included i...

Syntax

Splitter.SplitTextByRanges(ranges as list, optional startAtEnd as nullable logical) as function

About

This function returns a result that divides a given text into smaller sections based on specified starting points and lengths. If a length is set to zero, the remainder of the input will be included in the output list.

Explanation

Example 1 Segment the input by the designated position and length pairs, commencing from the beginning of the input. It is important to note that the ranges in this illustration overlap. Usage: Power Query M Splitter.SplitTextByRanges({{0, 4}, {2, 10}})("codelimiter") Output: {"code", "delimiter"} Example 2 Divide the input by the specified position and length pairs, starting from the conclusion of the input. Usage: Power Query M let startAtEnd = true in Splitter.SplitTextByRanges({{0, 5}, {6, 2}}, startAtEnd)("RedmondWA?98052") Output: {"WA", "98052"}