Splitter.SplitTextByLengths

Syntax

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

About

Returns a function that splits text into a list of text by each specified length.

Example 1

Split the input into the first two characters followed by the next three, starting from the beginning of the input.

Usage

Splitter.SplitTextByLengths({2, 3})("AB123")

Output

{"AB", "123"}

Example 2

Split the input into the first three characters followed by the next two, starting from the end of the input.

Usage

let
    startAtEnd = true
in
    Splitter.SplitTextByLengths({5, 2}, startAtEnd)("RedmondWA98052")

{"WA", "98052"}