Learn R Programming

pystr (version 2.0.0)

pystr_split: Split a string.

Description

Return a list of character vectors of the words in the string, using sep as the delimiter string.

Usage

pystr_split(str, sep = " ", maxsplit = nchar(str) - 1)

Arguments

str
A character vector.
sep
A character string.
maxsplit
A numeric integer.

Value

A list of character vectors.

Details

If maxsplit is given, at most maxsplit splits are done (thus, the character vector will have at most maxsplit + 1 elements). If maxsplit is not specified, then there is no limit on the number of splits (all possible splits are made). If sep is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings. The sep argument may consist of multiple characters. If sep is not specified, any whitespace string is a separator. Splitting an empty string returns an empty string.

References

https://docs.python.org/3/library/stdtypes.html#str.split

See Also

pystr_join, pystr_rsplit

Examples

Run this code
pystr_split("www.example.com", ".")
pystr_split("123123123", "2", 2)
pystr_split("1,,2,3", ",")
pystr_split("a--b--c", "--")

Run the code above in your browser using DataLab