# TextBetween - スクリプトおよびチャート関数

TextBetween() は、区切り文字として指定された文字間で行われる入力文字列でのテキストを返します。

構文:

TextBetween(text, delimiter1, delimiter2[, n])

戻り値データ型： 文字列

引数：

引数

| 引数 | 説明 |
| --- | --- |
| text | 元の文字列。 |
| delimiter1 | text で検索する最初の区切り文字 (または文字列) を指定します。 |
| delimiter2 | text で検索する 2 番目の区切り文字 (または文字列) を指定します。 |
| n | 検索する区切り文字のペアのうち、出現する区切り文字を定義します。たとえば、2 という値は、delimiter1 が 2 回目に現れてから、delimiter2 が 2 回目に現れるまでの文字を返します。 |

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

#### 例: チャートの数式

| 例 | 結果 |
| --- | --- |
| `TextBetween('<abc>',  			'<', '>')` | 'abc' を返します |
| `TextBetween('<abc><de>',   '<', '>',2)` | 'de' を返します |
| `TextBetween('abc', '<', '>')`<br><br>`TextBetween('<a<b', '<', '>')` | どちらの例もNULLを返します。<br><br>文字列に区切り文字が見つからない場合、NULLが返されます。 |
| `TextBetween('<>',  			'<', '>')` | 長さゼロの文字列を返します。 |
| `TextBetween('<abc>',  			'<', '>', 2)` | n は区切り文字の出現回数よりも大きいため、NULL を返します。 |

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

#### 例: ロード スクリプト

```
Load *,
textbetween(Text,'<','>') as TextBetween,
textbetween(Text,'<','>',2) as SecondTextBetween;
Load * inline [
Text
<abc><de>
<def><ghi><jkl> ];
```

結果

| テキスト | TextBetween | SecondTextBetween |
| --- | --- | --- |
| &lt;abc&gt;&lt;de&gt; | abc | de |
| &lt;def&gt;&lt;ghi&gt;&lt;jkl&gt; | def | ghi |