strings.hasPrefix() function

Warning! This page documents an earlier version of Flux, which is no longer actively developed. Flux v0.50 is the most recent stable version of Flux.

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

Output data type: Boolean

import "strings"

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

// returns true

Parameters

v

The string value to search.

Data type: String

t

The prefix to search for.

Data type: String

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

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