docs-v2/content/v2.0/reference/flux/functions/strings/containsany.md

914 B

title description menu weight related
strings.containsAny() function The strings.containsAny() function reports whether a specified string contains any characters from from another string.
v2_0_ref
name parent
strings.containsAny Strings
301
/v2.0/reference/flux/functions/strings/containsstr

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.

Data type: String

chars

Characters to search for.

Data type: String

Examples

Report if a string contains specific characters
import "strings"

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