cc: Split up a string (with separators) into a character vector.

View source: R/bruceR_utils.R

ccR Documentation

Split up a string (with separators) into a character vector.

Description

Split up a string (with separators) into a character vector (whitespace around separator is trimmed).

Usage

cc(..., sep = "auto", trim = TRUE)

Arguments

...

Character string(s).

sep

Pattern for separation. Defaults to "auto": , ; | \n \t

trim

Remove whitespace from start and end of string(s)? Defaults to TRUE.

Value

Character vector.

Examples

cc("a,b,c,d,e")

cc(" a , b , c , d , e ")

cc(" a , b , c , d , e ", trim=FALSE)

cc("1, 2, 3, 4, 5")

cc("A 1 , B 2 ; C 3 | D 4 \t E 5")

cc("A, B, C",
   " D | E ",
   c("F", "G"))

cc("
American
British
Chinese
")


bruceR documentation built on Sept. 27, 2023, 5:06 p.m.