Documentation

strings.strlen() function

The strings.strlen() function returns the length of a string. String length is determined by the number of UTF code points a string contains.

Output data type: Integer

import "strings"

strings.strlen(v: "apple")

// returns 5

Parameters

v

The string value to measure.

Data type: String

Examples

Filter based on string value length
import "strings"

data
  |> filter(fn: (r) => strings.strlen(v: r._measurement) <= 4)
Store the length of string values
import "strings"

data
  |> map(fn: (r) => ({
      r with
      length: strings.strlen(v: r._value)
    })
  )

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: