Splitter.SplitTextByLengths

This function returns a result where the input text is divided into smaller text segments based on a specified length, and the segments are stored in a list.

Syntax

Splitter.SplitTextByLengths(lengths as list, optional startAtEnd as nullable logical) as function

About

This function returns a result where the input text is divided into smaller text segments based on a specified length, and the segments are stored in a list.

Explanation

Divide the provided input into segments based on specified lengths, either from the beginning or end of the input, by using the SplitTextByLengths function in Power Query M language. Example 1: Input: "AB123" Split: Splitter.SplitTextByLengths({2, 3})("AB123") Result: {"AB", "123"} Example 2: Input: "RedmondWA98052" Split: Splitter.SplitTextByLengths({5, 2}, startAtEnd)("RedmondWA98052") Result: {"WA", "98052"}