Text.BetweenDelimiters
Text.BetweenDelimiters
Syntax
Text.BetweenDelimiters(
text as text,
startDelimiter as text,
endDelimiter as text,
optional startIndex as any,
optional endIndex as any
) as any
Remarks
返回 text 中位于指定的 startDelimiter 和 endDelimiter 之间的部分。 可选数字 startIndex 指示要考虑哪一次出现的 startDelimiter。 可选列表 startIndex 指示要考虑哪一次出现的 startDelimiter,以及应从输入的开头还是结尾编制索引。 endIndex 类似,不同之处在于,相对于 startIndex 编制索引。
Examples
Example #1
获取 "111 (222) 333 (444)" (第一个)左括号及其随后(第一个)右括号之间的部分。
Text.BetweenDelimiters("111 (222) 333 (444)", "(", ")")
Result:
"222"
Example #2
获取 "111 (222) 333 (444)" 第二个左括号及其随后第一个右括号之间的部分。
Text.BetweenDelimiters("111 (222) 333 (444)", "(", ")", 1, 0)
Result:
"444"
Example #3
获取 "111 (222) 333 (444)" 倒 数第二个左括号及其随后第二个右括号之间的部分。
Text.BetweenDelimiters("111 (222) 333 (444)", "(", ")", {1, RelativePosition.FromEnd}, {1, RelativePosition.FromStart})
Result:
"222) 333 (444"
Category
Text.Transformations