Learn R Programming

cwhmisc (version 6.0)

replacechar: Replace a character in a string by another

Description

replacechar replaces a character in a string by another, deprecated!

Usage

replacechar(str, char = "_", newchar = ".") # is gsub(char, newchar,str)

Arguments

str
The string to be altered.
char
The character to be replaced.
newchar
The character to replace with.

Value

The altered string.

Examples

Run this code
replacechar("my_queer_file,name") # "my.queer.file,name"
replacechar("my_queer_file,name","m","M") # "My.queer.file,naMe"

Run the code above in your browser using DataLab