strings.ends_with

以下でサポートされています。
strings.ends_with(value, suffix)

説明

関数は 2 つの文字列 (value, suffix) を取ります。接尾辞が空ではなく、値の末尾にある場合は true を返します。

パラメータのデータ型

STRING、STRING

戻り値の型

BOOL

コードサンプル

次のコードサンプルは、strings.ends_with 関数を使用するいくつかの方法を示しています。

例: true を返す

接尾辞が値の末尾にある場合は true を返します。

strings.ends_with(target.hostname, "com") = true
例: false を返す

接尾辞が値の末尾にない場合は false を返します。

strings.ends_with(target.hostname, "com") = false
例: 同一の場合に false を返す

接尾辞と値が同じ場合は false を返します。

target.hostname != "example.com"
strings.ends_with("str", "str") = true
例: 接尾辞が空の場合に false を返す

接尾辞が空の文字列の場合、false を返します。

target.hostname != "example.com"
strings.ends_with("str", "") = false
例: 値が空の場合に false を返す

値が空の文字列の場合、false を返します。

target.hostname != "example.com"
strings.ends_with("", "str") = false
例: 接尾辞と値が空の場合に false を返す

接尾辞と値が空の文字列の場合、false を返します。

target.hostname != "example.com"
strings.ends_with("", "") = false