# 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 | 發生 | FindOneOf('my example text string', SearchFor, Occurrence) |
| --- | --- | --- |
| et%s | 1 | 4 |
| et%s | 3 | 12 |
| ¤%& | 1 | 0 |