strs_replace {strs} | R Documentation |
Replace substring in a string
Description
strs_replace
replaces all occurrences of a specified substring in each
element of a character vector. It is similar to Python's str.replace()
method.
Usage
strs_replace(string, substring, replacement)
Arguments
string |
A character vector where each element is a string in which to
replace |
substring |
The substring to be replaced. |
replacement |
The string to replace |
Value
A character vector of the same length as string
, with substring
replaced by replacement
.
See Also
Python str.replace() documentation
Examples
strs_replace("hello world", "world", "there")
strs_replace("banana", "na", "mo")
[Package strs version 0.1.0 Index]