strings: String / text processing functions

Description Usage Arguments Details References Examples

Description

String / text processing functions

Usage

1
2
3
4
5
6
7
8
9
trim(x)

chomp(x)

text_wrap(x, n = 20L)

translit(x, ...)

rand_string(n)

Arguments

x

a character vector

n

an integer of length 1. text_wrap() will silently coerce any numeric value passed to n to an integer.

...

addtional parameters used by specific functions. See Details.

Details

References

I attribute the regular expression that powers text_wrap() to StackOverflow user xiechao: http://stackoverflow.com/a/2352006/3277821

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
trim("foo ")
trim(" bar ")
trim("baz")
chomp("foo\n")
chomp("bar")
s <- "The quick brown fox jumped over the lazy dog."
text_wrap(s)
text_wrap(s, 10)
cat(paste0(text_wrap(s), "\n"))
rand_string()
rand_string(5)

sboysel/boysel documentation built on May 29, 2019, 3:24 p.m.