strip_invalid_chars(x, invalid_chars, char_desc = gettext("invalid"))
strip_non_alphanumeric(x)
strip_non_numeric(x, allow_x = FALSE, allow_plus = FALSE)
TRUE
, the letter "X" is allowed - useful for check
digits.TRUE
, the symbol "+" is allowed - useful for
phone numbers.x
, consisting of
strings without the characters detailed in the invalid_chars
.strip_invalid_chars(
" We're floating\tin space\n\n\n", "[[:space:]]", "whitespace"
)
strip_non_numeric(" +44 800-123-456 ", allow_plus = TRUE)
#Inputs such as factors as coerced to character.
strip_non_alphanumeric(factor(c(" A1\t1AA.", "*(B2^2BB)%")))
Run the code above in your browser using DataLab