powered by
strs_slice extracts substrings from each element of a character vector, specified by start and stop positions. It is similar to Python's slicing syntax for strings, but it uses 1 indexing and stops are inclusive.
strs_slice
strs_slice(string, start = 1L, stop = -1L, ..., step = 1L)
A character vector of the same length as string, with each element being the sliced substring.
string
A character vector where each element is a string to slice.
An integerish scalar for the starting position for slicing (inclusive).
An integerish scalar for the ending position for slicing (inclusive).
Used to force keyword argument usage of step.
step
An integer greater than 0 or equal to -1 for the step size. If -1 is provided, each string will be reversed after slicing operations.
strs_slice("hello world", 1, 5) strs_slice("hello world", 7) strs_slice("hello world", start = 7, stop = 11)
Run the code above in your browser using DataLab