strs_removesuffix: Remove a suffix from a string

View source: R/removesuffix.R

strs_removesuffixR Documentation

Remove a suffix from a string

Description

strs_removesuffix removes a specified suffix from the end of each element of a character vector. It is similar to Python's str.removesuffix() method.

Usage

strs_removesuffix(string, suffix)

Arguments

string

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

suffix

The suffix to remove.

Value

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

See Also

Python str.removesuffix() documentation

Examples

strs_removesuffix("StringTest", "Test")
strs_removesuffix("hello world", "world")

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