Learn R Programming

pystr (version 2.0.0)

pystr_partition: Partition a string.

Description

Split the string at the first occurrence of sep, and return a list of character vectors containing the part before the separator, the separator itself, and the part after the separator.

Usage

pystr_partition(str, sep)

Arguments

str
A character vector.
sep
A character string.

Value

A list of character vectors.

Details

If the separator is not found, return a character vector containing the string itself, followed by two empty strings.

References

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

See Also

pystr_rpartition

Examples

Run this code
pystr_partition("onetwothreeonetwothree", "two")

Run the code above in your browser using DataLab