Text.PositionOfAny

Syntax

Text.PositionOfAny(
    text as text,
    characters as list,
    optional occurrence as nullable number
) as any

About

返回列表中characterstext找到的任何字符的第一个位置。 可选参数 occurrence 可用于指定要返回的匹配位置。

示例 1

在文本“Hello, World!”中找到“W”或“H”的第一个位置。

用法

Text.PositionOfAny("Hello, World!", {"H", "W"})

输出

0

示例 2

在文本“Hello, World!”中查找“W”或“H”的所有位置。

用法

Text.PositionOfAny("Hello, World!", {"H", "W"}, Occurrence.All)

输出

{0, 7}