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"

results matching ""

    No results matching ""