docs-v2/content/flux/v0.x/stdlib/strings/hassuffix.md

1.0 KiB

title description aliases menu weight flux/v0.x/tags related introduced
strings.hasSuffix() function The strings.hasSuffix() function indicates if a string ends with a specified suffix.
/influxdb/v2.0/reference/flux/functions/strings/hassuffix/
/influxdb/v2.0/reference/flux/stdlib/strings/hassuffix/
/influxdb/cloud/reference/flux/stdlib/strings/hassuffix/
flux_0_x_ref
name parent
strings.hasSuffix strings
301
tests
/flux/v0.x/stdlib/strings/hasprefix
0.18.0

The strings.hasSuffix() function indicates if a string ends with a specified suffix.

Output data type: Boolean

import "strings"

strings.hasSuffix(v: "go gopher", suffix: "go")

// returns false

Parameters

v

The string value to search.

suffix

The suffix to search for.

Filter based on the presence of a suffix in a column value
import "strings"

data
    |> filter(fn:(r) => strings.hasSuffix(v: r.metric, suffix: "_count" ))