strings.repeat() function
The strings.repeat()
function returns a string consisting of i
copies of a specified string.
Output data type: String
import "strings"
strings.repeat(v: "ha", i: 3)
// returns "hahaha"
Parameters
v
The string value to repeat.
Data type: String
i
The number of times to repeat v
.
Data type: Integer
Examples
Repeat a string based on existing columns
import "strings"
data
|> map(fn: (r) => ({
laugh: r.laugh
intensity: r.intensity
laughter: strings.repeat(v: r.laugh, i: r.intensity)
})
)
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.