File: toCamelCase.Rd

package info (click to toggle)
r-cran-r.utils 2.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,864 kB
  • sloc: sh: 18; makefile: 6
file content (64 lines) | stat: -rw-r--r-- 1,909 bytes parent folder | download | duplicates (5)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Do not modify this file since it was automatically generated from:
% 
%  toCamelCase.R
% 
% by the Rdoc compiler part of the R.oo package.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\name{toCamelCase}
\alias{toCamelCase.default}
\alias{toCamelCase}

\title{Converts a string of words into a merged camel-cased word}

\description{
  Converts a string of words into a merged camel-cased word, e.g. "a single espresso" is converted to "aSingleEspresso".
}

\usage{
\method{toCamelCase}{default}(s, capitalize=FALSE, preserveSameCase=FALSE, split="[ \t]+", ...)
}

\arguments{
 \item{s}{A \code{\link[base]{character}} \code{\link[base]{vector}}.}
 \item{capitalize}{If \code{\link[base:logical]{TRUE}}, the first letter will be in upper case,
   otherwise it will be in lower case.}
 \item{preserveSameCase}{If \code{\link[base:logical]{TRUE}}, words that are in all upper case
   will remain as all same case words, e.g. acronyms.}
 \item{split}{A pattern used to identify words.  See \code{\link[base]{strsplit}}()
   for more details.}
 \item{...}{Not used.}
}

\value{
 Returns a \code{\link[base]{character}} \code{\link[base]{vector}}.
}

\examples{
s <- "hello world"
print(toCamelCase(s))  # helloWorld
print(toCamelCase(s, capitalize=TRUE))  # HelloWorld
stopifnot(toCamelCase(s) == toCamelCase(toCamelCase(s)))

s <- "GEO Accession"
print(toCamelCase(s))  # gEOAccession
print(toCamelCase(s, preserveSameCase=TRUE))  # geoAccession
print(toCamelCase(s, capitalize=TRUE))  # GEOAccession
print(toCamelCase(s, capitalize=TRUE, preserveSameCase=TRUE))  # GEOAccession
stopifnot(toCamelCase(s) == toCamelCase(toCamelCase(s)))
}

\author{Henrik Bengtsson}

\seealso{
  \code{\link[R.utils]{capitalize}}.
  \code{\link[base]{chartr}}().
}




\keyword{programming}
\keyword{IO}
\keyword{internal}