strs_split: Split string into substrings

View source: R/split.R

strs_splitR Documentation

Split string into substrings

Description

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.

See Also

Python str.split() documentation

Examples

strs_split("hello world", " ")
strs_split("one,two,three", ",", maxsplit = 1)

strs documentation built on Sept. 11, 2024, 6:44 p.m.