strs_rstrip: Right strip characters from a string

View source: R/rstrip.R

strs_rstripR Documentation

Right strip characters from a string

Description

strs_rstrip removes trailing characters (spaces by default) from each element of a character vector. It is similar to Python's str.rstrip() method.

Usage

strs_rstrip(string, chars = NULL)

Arguments

string

A character vector where each element is a string to be right-stripped.

chars

An optional string of characters to be removed from the end of each element. If NULL, whitespace is removed.

Value

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

See Also

Python str.rstrip() documentation

Examples

strs_rstrip("hello world    ")
strs_rstrip("hello worldxxx", chars = "x")

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