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

1.1 KiB

title description aliases menu weight related introduced
strings.containsAny() function The strings.containsAny() function reports whether a specified string contains any characters from from another string.
/influxdb/v2.0/reference/flux/functions/strings/containsany/
/influxdb/v2.0/reference/flux/stdlib/strings/containsany/
/influxdb/cloud/reference/flux/stdlib/strings/containsany/
flux_0_x_ref
name parent
strings.containsAny strings
301
/flux/v0.x/stdlib/strings/containsstr
0.18.0

The strings.containsAny() function reports whether a specified string contains characters from another string.

Output data type: Boolean

import "strings"

strings.containsAny(v: "abc", chars: "and")

// returns true

Parameters

v

The string value to search.

chars

Characters to search for.

Examples

Report if a string contains specific characters
import "strings"

data
    |> map(fn: (r) => ({r with _value: strings.containsAny(v: r.price, chars: "£$¢")}))