strings.trimSuffix() function
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")
})
)
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.