1.1 KiB
1.1 KiB
title | description | menu | weight | related | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
strings.trimSuffix() function | The `strings.trimSuffix()` function removes a suffix from a string. Strings that do not end with the suffix are returned unchanged. |
|
301 |
|
The strings.trimSuffix()
function removes a suffix from a string.
Strings that do not end with the suffix are returned unchanged.
Output data type: String
import "strings"
strings.trimSuffix(v: "123_abc", suffix: "abc")
// returns "123_"
Parameters
v
The string value to trim.
Data type: String
suffix
The suffix to remove.
Data type: String
Examples
Remove a suffix from all values in a column
import "strings"
data
|> map(fn: (r) => ({
r with
sensorID: strings.trimSuffix(v: r.sensorId, suffix: "_s12")
})
)