docs-v2/content/flux/v0.x/stdlib/strings/split.md

1.1 KiB

title description aliases menu weight related introduced
strings.split() function The strings.split() function splits a string on a specified separator and returns an array of substrings.
/influxdb/v2.0/reference/flux/functions/strings/split/
/influxdb/v2.0/reference/flux/stdlib/strings/split/
/influxdb/cloud/reference/flux/stdlib/strings/split/
flux_0_x_ref
name parent
strings.split strings
301
/flux/v0.x/stdlib/strings/splitafter
/flux/v0.x/stdlib/strings/splitaftern
/flux/v0.x/stdlib/strings/splitn
0.18.0

The strings.split() function splits a string on a specified separator and returns an array of substrings.

Output data type: Array of strings

import "strings"

strings.split(v: "a flux of foxes", t: " ")

// returns ["a", "flux", "of", "foxes"]

Parameters

v

The string value to split.

t

The string value that acts as the separator.

Examples

Split a string into an array of substrings
import "strings"

data
    |> map (fn:(r) => strings.split(v: r.searchTags, t: ","))