Documentation

strings.containsStr() function

The strings.containsStr() function reports whether a string contains a specified substring.

Output data type: Boolean

import "strings"

strings.containsStr(v: "This and that", substr: "and")

// returns true

Parameters

v

The string value to search.

substr

The substring value to search for.

Examples

Report if a string contains a specific substring
import "strings"

data
    |> map(fn: (r) => ({r with _value: strings.containsStr(v: r.author, substr: "John")}))

Was this page helpful?

Thank you for your feedback!


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.