string_switchletter: Switch a single letter in a string with a new letter

View source: R/string_switchletter.R

string_switchletterR Documentation

Switch a single letter in a string with a new letter

Description

Switch a single letter in a character string that is surrounded by either full stops, underscores, or dashes with a new letter. This is helpful when a file path has a single letter for area or some other category and you want to easily switch it out with a new letter. For example, "apple-a-sweet" can easily be changed to "apple-b-sweet" with this function.

Usage

string_switchletter(x, newletter)

Arguments

x

A character string.

newletter

A character string of any length you want, but only the first letter will be used to replace the value in x. Note that we do not pay attention to case here and all new letters will be lower-case.

Author(s)

Kelli F. Johnson


iantaylor-NOAA/Lingcod_2021 documentation built on Oct. 30, 2024, 6:42 p.m.