strings.containsAny() function

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

*Output data type: Boolean*

  1. import "strings"
  2. strings.containsAny(v: "abc", chars: "and")
  3. // 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
  1. import "strings"
  2. data
  3. |> map(fn: (r) => ({
  4. r with
  5. _value: strings.containsAny(v: r.price, chars: "£$¢")
  6. })
  7. )

Related articles