Learn R Programming

strs (version 0.1.0)

strs_removesuffix: 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)

Value

A character vector of the same length as string, with the suffix

removed from each element.

Arguments

string

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

suffix

The suffix to remove.

See Also

Examples

Run this code
strs_removesuffix("StringTest", "Test")
strs_removesuffix("hello world", "world")

Run the code above in your browser using DataLab