fsub: Fixed-value string substitution

View source: R/fsub.R

fsubR Documentation

Fixed-value string substitution

Description

Finds strings from pats in x and replaces them with corresponding values of (possibly recycled) subs.

Usage

fsub(x, pats, subs)

Arguments

x

An atomic character object.

pats

A complete character vec of patterns to replace.

subs

A complete character vec of replacement strings

Value

Atomic character object.

See Also

Other strings: blank(), chn(), delim(), gr, ipat(), makestr(), markdown_help(), maxnch(), ox(), ox_vals(), pgrid_help(), revstr(), spaces(), ss_help(), tocase(), weave()

Examples

egArg1 <- c("a", "few", "words", "in", "a string")
agArg2 <- paste0(egArg1, collapse = " ")
egPats <- c("a", "f", "w", "i", "s", " ")
egSubs <- c("A", "F", "W", "I", "S", "_")
egArg1
egArg2
fsub(egArg1, egPats, egSubs)
fsub(egArg2, egPats, egSubs)
fsub(egArg1, egPats, "_")
fsub(egArg2, egPats, "_")

j-martineau/uj documentation built on Sept. 14, 2024, 4:40 a.m.