string_strip: Strip non-letter characters from the beginning and end of a...

View source: R/string.R

string_stripR Documentation

Strip non-letter characters from the beginning and end of a string

Description

Remove any non-letter characters from the beginning and end of a character string.

Usage

string_strip(
  string,
  rm_period = FALSE,
  keep = NULL,
  side = c("both", "left", "right")
)

Arguments

string

A character vector.

rm_period

Should ending periods be removed?

keep

A single character vector of character(s) to keep. Only retains characters that directly precede the first and follow the last letter.

side

Side of the character string to trim. One of c("both", "right", "left").

Value

A character vector.

Examples

string_strip("1. La Lionne et l'Ourse._ ")
string_strip("1. La Lionne et l'Ourse._ ", side = "right")
string_strip("1. (La Lionne et l'Ourse)_ ", keep = "()")

arnaudgallou/toolkit documentation built on Nov. 25, 2022, 5:42 p.m.