1.1 KiB
1.1 KiB
title | description | aliases | menu | weight | introduced | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
strings.substring() function | The strings.substring() function returns a substring based on `start` and `end` parameters. Indices are based on UTF code points. |
|
|
301 | 0.35.0 |
The strings.substring()
function returns a substring based on start
and end
parameters.
These parameters are represent indices of UTF code points in the string.
Output data type: String
import "strings"
strings.substring(v: "influx", start: 0, end: 4)
// returns "infl"
Parameters
v
The string value to search.
start
The starting inclusive index of the substring.
end
The ending exclusive index of the substring.
Examples
Store the first four characters of a string
data
|> map(fn: (r) => ({r with abbr: strings.substring(v: r.name, start: 0, end: 4)}))