# FindOneOf - 脚本和图表函数

FindOneOf() 用于搜索字符串，以便从一组提供的字符中找到任意字符出现的位置。如果不提供第三个参数（值大于 1），则返回任意字符在搜索集合中首次出现的位置。如果未找到匹配值，则返回 0。

语法：

FindOneOf(text, char\_set[, count])

返回数据类型： 整数

参数：

参数

| 参数 | 说明 |
| --- | --- |
| text | 原始字符串。 |
| char\_set | 在 text 中搜索的字符集。 |
| count | 定义搜索哪一次出现的任何字符。例如，值为 2，则搜索第二次出现的。 |

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/FindOneOf.htm)

#### 示例：图表表达式

| 示例 | 结果 |
| --- | --- |
| `FindOneOf(   'my example text string', 'et%s')` | 返回“4”，因为“e”是示例字符串中的第四个字符。 |
| `FindOneOf(   'my example text string', 'et%s', 3)` | 返回 '12'，因为是搜索以下任何字符： e、t、% 或 s，"t"是第三次出现的位置，因此是在示例字符串的位置 12。 |
| `FindOneOf(   'my example text string', '¤%&')` | 返回“0”，因为示例字符串中不存在 ¤、% 或 & 中的任何字符。 |

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/FindOneOf.htm)

#### 加载脚本和结果

```
Load *
Inline
[SearchFor, Occurrence
et%s,1
et%s,3
¤%&,1]
```

结果

| SearchFor | Occurrence | FindOneOf('my example text string', SearchFor, Occurrence) |
| --- | --- | --- |
| et%s | 1 | 4 |
| et%s | 3 | 12 |
| ¤%& | 1 | 0 |