1.3 KiB
1.3 KiB
title | description | aliases | menu | weight | related | introduced | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
strings.trim() function | The strings.trim() function removes leading and trailing characters specified in the cutset from a string. |
|
|
301 |
|
0.18.0 |
The strings.trim()
function removes leading and trailing characters specified
in the cutset
from a string.
Output data type: String
import "strings"
strings.trim(v: ".abc.", cutset: ".")
// returns "abc"
Parameters
v
String to remove characters from.
cutset
The leading and trailing characters to remove from the string.
Only characters that match the cutset
string exactly are trimmed.
Examples
Trim leading and trailing periods from all values in a column
import "strings"
data
|> map(fn: (r) => ({r with variables: strings.trim(v: r.variables, cutset: ".")}))