strs_split
splits each element of a character vector into substrings based
on a separator. It is similar to Python's str.split()
method.
Usage
strs_split(string, sep = " ", maxsplit = -1L)
Arguments
- string
A character vector to split.
- sep
The separator on which to split the string.
- maxsplit
The maximum number of splits to perform. If -1, all possible
splits are performed.
Value
A list of character vectors, with each vector containing the split
substrings from the corresponding element of string
.
Examples
strs_split("hello world", " ")
#> [[1]]
#> [1] "hello" "world"
#>
strs_split("one,two,three", ",", maxsplit = 1)
#> [[1]]
#> [1] "one" "two,three"
#>