strings.ends_with

Supported in:
strings.ends_with(value, suffix)

Description

Function takes two strings (value, suffix). Returns true if the suffix is non-empty and at end-of-value.

Param data types

STRING, STRING

Return type

BOOL

Code samples

The following code samples illustrate some of the ways you might use the strings.ends_with function.

Example: returns true

Returns true when the suffix is found at end-of-value.

strings.ends_with(target.hostname, "com") = true
Example: returns false

Returns false when the suffix isn't at end-of-value.

strings.ends_with(target.hostname, "com") = false
Example: returns false when identical

Returns false when suffix and value are identical.

target.hostname != "example.com"
strings.ends_with("str", "str") = true
Example: returns false when suffix empty

Returns false when suffix is an empty string.

target.hostname != "example.com"
strings.ends_with("str", "") = false
Example: returns false when value empty

Returns false when value is an empty string.

target.hostname != "example.com"
strings.ends_with("", "str") = false
Example: returns false when suffix and value are empty

Returns false when suffix and value are empty strings.

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