This function extracts all digits found in character vector and returns them as a list.

getDigits(x, collapse = NULL)

Arguments

x

a character vector where digits are sought, or an object which can be coerced by as.character to a character vector.

collapse

an optional character string to separate the results (see [base::paste()).

Value

A list of digits.

Examples

getDigits('txt012-34')
#> [[1]] #> [1] "012" "34" #>