Splitter.SplitTextByCharacterTransition
SplitterReturns a function that splits text at transitions between character types.
Syntax
Splitter.SplitTextByCharacterTransition(before as anynonnull, after as anynonnull) as functionParameters
| Name | Type | Required | Description |
|---|---|---|---|
before | anynonnull | Yes | A character classification function or list of characters. The split occurs where a character matching before is followed by a character matching after. |
after | anynonnull | Yes | A character classification function or list of characters. The split occurs where a character matching before is followed by a character matching after. |
Return Value
function — A function that takes a text value and returns a list of text parts split where the character type transitions from before to after.
Remarks
Splitter.SplitTextByCharacterTransition returns a function that splits text at the boundary where one character type transitions to another. You specify the before and after character classifications using functions like Character.IsLetter and Character.IsNumber, or by providing lists of characters.
This is especially useful for splitting strings that combine letters and digits without a delimiter — for example, splitting "ABC123" into "ABC" and "123".
Examples
Example 1: Split where letters transition to digits
let
SplitFn = Splitter.SplitTextByCharacterTransition(Character.IsLetter, Character.IsNumber),
Parts = SplitFn("WidgetA100")
in
#table({"TextPart", "NumberPart"}, {{Parts{0}, Parts{1}}})Result
TextPart | NumberPart | |
|---|---|---|
| 1 | WidgetA | 100 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks