共用方式為


Text.BetweenDelimiters

語法

Text.BetweenDelimiters(text as nullable text, startDelimiter as text, endDelimiter as text, optional startIndex as any, optional endIndex as any) as any

關於

傳回介於指定 startDelimiterendDelimiter 之間的 text 部分。 選擇性數字 startIndex 表示應考量哪一個出現的 startDelimiter。 選擇性清單 startIndex 表示應考量哪一個出現的 startDelimiter,以及編製索引時應從輸入的開頭或結尾開始進行。 endIndex 與其相似,差別在於編製索引是以相對於 startIndex 的方式進行。

範例 1

取得 "111 (222) 333 (444)" 介於 (第一個) 左括弧與其後 (第一個) 右括弧之間的部分。

使用方式

Text.BetweenDelimiters("111 (222) 333 (444)", "(", ")")

輸出

"222"

範例 2

取得 "111 (222) 333 (444)" 介於第二個左括弧與其後第一個右括弧之間的部分。

使用方式

Text.BetweenDelimiters("111 (222) 333 (444)", "(", ")", 1, 0)

輸出

"444"

範例 3

取得 "111 (222) 333 (444)" 從結尾開始,介於第二個左括弧與其後第二個右括弧之間的部分。

使用方式

Text.BetweenDelimiters("111 (222) 333 (444)", "(", ")", {1, RelativePosition.FromEnd}, {1, RelativePosition.FromStart})

輸出

"222) 333 (444"