strings.hasPrefix() function

The strings.hasPrefix() function indicates if a string begins with a specified prefix.

Output data type: Boolean

import "strings"

strings.hasPrefix(v: "go gopher", prefix: "go")

// returns true



The string value to search.

Data type: String


The prefix to search for.

Data type: String

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

  |> filter(fn:(r) => strings.hasPrefix(v: r.metric, prefix: "int_" ))

New! Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: