1.0 KiB
1.0 KiB
title | description | menu | weight | related | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
strings.splitN() function | The strings.splitN() function splits a string on a specified separator and returns an array of `i` substrings. |
|
301 |
|
The strings.splitN()
function splits a string on a specified separator and returns
an array of i
substrings.
Output data type: Array of strings
import "strings"
strings.splitN(v: "a flux of foxes", t: " ", i: 2)
// returns ["a", "flux", "of foxes"]
Parameters
v
The string value to split.
Data type: String
t
The string value that acts as the separator.
Data type: String
i
The number of substrings to return.
Data type: Integer
Examples
Split a string into an array of substrings
import "strings"
data
|> map (fn:(r) => strings.splitN(v: r.searchTags, t: ","))