OpenBI Docs Buy

Text.Middle

Characters from the middle of a text, from a position on, forgiving a count that runs past the end.

Group: Text and characters. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Text.Middle(text as nullable text, start as number, optional count as nullable number) as nullable text
ParameterTypeDescription
textnullable textThe text to work on; null gives null.
startnumberWhere to begin, from 0 for the first character.
countnullable number
optional
How many characters to take. Left out, to the end.

Returns

nullable text. The characters asked for, or as many as there are.

Remarks

  • Unlike Text.Range, a count that goes past the end is no error: you get the characters up to the end.

Examples

The postcode in a code

Text.Middle("NO-0150-Oslo", 3, 4)
"0150"

A count past the end

Text.Middle("Oslo", 2, 10)
"lo"

Text.Range, Text.Start, Text.End, Text.BetweenDelimiters.

Last updated · OpenBI Studio 0.3.79