alnum_id | R Documentation |
Substitute certain (by default, non-alphanumeric) characters with dashes and remove extra dashes at both ends to generate ID strings.
alnum_id(x, exclude = "[^[:alnum:]]+")
x |
A character vector. |
exclude |
A (Perl) regular expression to detect characters to be replaced by dashes. By default, non-alphanumeric characters are replaced. |
A character vector of IDs.
x = c("Hello world 123!", "a &b*^##c 456") xfun::alnum_id(x) xfun::alnum_id(x, "[^[:alpha:]]+") # only keep alphabetical chars
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.