

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# endsWith
<a name="endsWith-function"></a>

`endsWith` は、式が指定した部分文字列で終わるかどうかを判断します。式が部分文字列で終わる場合、`endsWith` は true を返し、それ以外の場合は false を返します。

## 構文
<a name="endsWith-function-syntax"></a>

```
endsWith(expression, substring, string-comparison-mode)
```

## 引数
<a name="endsWith-function-arguments"></a>

 *expression*   
expression は文字列である必要があります。文字列データ型を使用しているフィールドの名前、**'12 Main Street'** のようなリテラル値、または文字列を出力する別の関数の呼び出しを使用できます。

 *substring*   
式と照合する文字のセット。部分文字列は式の中で複数回出現することがあります。

 文字列比較モード   
(オプション) 文字列比較モードを指定し、以下を使用します。  
+ `CASE_SENSITIVE` – 文字列比較では、大文字と小文字が区別されます。
+ `CASE_INSENSITIVE` – 文字列比較では、大文字と小文字が区別されません。
空白の場合、この値はデフォルトで `CASE_SENSITIVE` です。

## 戻り型
<a name="endsWith-function-return-type"></a>

ブール値

## 例
<a name="endsWith-function-example"></a>

### デフォルトの大文字と小文字を区別した例
<a name="endsWith-function-example-default-case-sensitive"></a>

次の例では大文字と小文字を区別し、`state_nm` endsWith **"York"** かどうかを評価します。

```
endsWith(state_nm, "York")
```

次が指定したフィールド値です。

```
New York
new york
```

これらのフィールド値に対して、以下の値が返されます。

```
true
false
```

### 大文字と小文字を区別しない例
<a name="endsWith-function-example-case-insensitive"></a>

次の例では大文字と小文字を区別せず、`state_nm` endsWith **"york"** かどうかを評価します。

```
endsWith(state_nm, "york", CASE_INSENSITIVE)
```

次が指定したフィールド値です。

```
New York
new york
```

これらのフィールド値に対して、以下の値が返されます。

```
true
true
```

### 条件ステートメントの例
<a name="endsWith-function-example-conditional-statements"></a>

この `endsWith` 関数は、「[avgIf](https://docs.aws.amazon.com/quicksight/latest/user/avgIf-function.html)」、「[minIf](https://docs.aws.amazon.com/quicksight/latest/user/minIf-function.html)」、「[distinct\$1countIf](https://docs.aws.amazon.com/quicksight/latest/user/distinct_countIf-function.html)」、「[countIf](https://docs.aws.amazon.com/quicksight/latest/user/countIf-function.html)」、「[maxIf](https://docs.aws.amazon.com/quicksight/latest/user/maxIf-function.html)」、「[medianIf](https://docs.aws.amazon.com/quicksight/latest/user/medianIf-function.html)」、「[stdevIf](https://docs.aws.amazon.com/quicksight/latest/user/stdevIf-function.html)」、「[stdevpIf](https://docs.aws.amazon.com/quicksight/latest/user/stdevpIf-function.html)」、「[sumIf](https://docs.aws.amazon.com/quicksight/latest/user/sumIf-function.html)」、「[varIf](https://docs.aws.amazon.com/quicksight/latest/user/varIf-function.html)」、「[varpIf](https://docs.aws.amazon.com/quicksight/latest/user/varpIf-function.html)」の If 関数内の条件ステートメントとして使用できます。

次の例では、`state_nm` の末尾が **"York"** の場合にのみ `Sales` が合計されます。

```
sumIf(Sales,endsWith(state_nm, "York"))
```

### 例は含まれていません
<a name="endsWith-function-example-does-not-start-with"></a>

条件 `NOT` 演算子を使用して、式が指定された部分文字列で始まらないかどうかを評価できます。

```
NOT(endsWith(state_nm, "York"))
```

### 数値を使用した例
<a name="endsWith-function-example-numeric-values"></a>

`toString` 関数を適用することで、式または部分文字列引数に数値を使用できます。

```
endsWith(state_nm, toString(5) )
```