共用方式為


Text.Middle

語法

Text.Middle(
    text as nullable text,
    start as number,
    optional count as nullable number
) as nullable text

關於

在位移 count 的位置傳回 text 個字元,或傳回直到 start 結尾的所有字元。

範例 1

從文字 "Hello World" 中擷取一個子字串,從索引 6 開始,跨越 5 個字元。

使用方式

Text.Middle("Hello World", 6, 5)

輸出

"World"

範例 2

從索引 6 開始到結尾來尋找文字 "Hello World" 中的子字串。

使用方式

Text.Middle("Hello World", 6, 20)

輸出

"World"

範例 3

從文字 "Hello World" 中,從索引 0 開始,截取長度為 2 個字元的子字串。

使用方式

Text.Middle("Hello World", 0, 2)

輸出

"He"