R/str_remove_all_letters.R

Defines functions str_remove_all_letters

Documented in str_remove_all_letters

#' Removes all letters in a string
#' @import stringr
#' @export

str_remove_all_letters <-
        function(x, type = c("both", "upper", "lower")) {
                if (type == "both") {
                        return(stringr::str_remove_all(x, pattern = "[A-Za-z]"))
                } else if (type == "upper") {
                        return(stringr::str_remove_all(x, pattern = "[A-Z]"))
                } else if (type == "lower") {
                        return(stringr::str_remove_all(x, pattern = "[a-z]"))
                }
        }
meerapatelmd/centipede documentation built on Jan. 1, 2021, 9:27 a.m.