strs_removeprefix: Remove a prefix from a string

View source: R/removeprefix.R

strs_removeprefixR Documentation

Remove a prefix from a string

Description

strs_removeprefix removes a specified prefix from the start of each element of a character vector. It is similar to Python's str.removeprefix() method.

Usage

strs_removeprefix(string, prefix)

Arguments

string

A character vector where each element is a string from which to remove the prefix.

prefix

The prefix to remove.

Value

A character vector of the same length as string, with the prefix removed from each element.

See Also

Python str.removeprefix() documentation

Examples

strs_removeprefix("testString", "test")
strs_removeprefix("hello world", "hello")

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