File: alnum_id.Rd

package info (click to toggle)
r-cran-xfun 0.37%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 792 kB
  • sloc: ansic: 242; sh: 22; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 716 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/string.R
\name{alnum_id}
\alias{alnum_id}
\title{Generate ID strings}
\usage{
alnum_id(x, exclude = "[^[:alnum:]]+")
}
\arguments{
\item{x}{A character vector.}

\item{exclude}{A (Perl) regular expression to detect characters to be
replaced by dashes. By default, non-alphanumeric characters are replaced.}
}
\value{
A character vector of IDs.
}
\description{
Substitute certain (by default, non-alphanumeric) characters with dashes and
remove extra dashes at both ends to generate ID strings.
}
\examples{
x = c("Hello world 123!", "a  &b*^##c 456")
xfun::alnum_id(x)
xfun::alnum_id(x, "[^[:alpha:]]+")  # only keep alphabetical chars
}