The R Project SVN R

Rev

Rev 85981 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 85981 Rev 86901
Line 1... Line 1...
1
% File src/library/tools/man/toTitleCase.Rd
1
% File src/library/tools/man/toTitleCase.Rd
2
% Part of the R package, https://www.R-project.org
2
% Part of the R package, https://www.R-project.org
3
% Copyright 2015 R Core Team
3
% Copyright 2015--2024 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{toTitleCase}
6
\name{toTitleCase}
7
\alias{toTitleCase}
7
\alias{toTitleCase}
8
\title{Convert Titles to Title Case}
8
\title{Convert Titles to Title Case}
9
\description{
9
\description{
10
  Convert a character vector to title case, especially package titles.
10
  Convert a character vector to title case for English, especially package titles.
11
}
11
}
12
\usage{
12
\usage{
13
toTitleCase(text)
13
toTitleCase(text)
14
}
14
}
15
\arguments{
15
\arguments{
16
  \item{text}{a character vector.}
16
  \item{text}{a character vector.}
17
}
17
}
18
\details{
18
\details{
19
  This is intended for English text only.
19
  This is intended for English text only.
20
 
20
 
21
  No definition of\sQuote{title case} is universally accepted: all agree
21
  No definition of \sQuote{title case} is universally accepted: all agree
22
  that \sQuote{principal} words are capitalized and common words like
22
  that \sQuote{principal} words are capitalized and common words like
23
  \sQuote{for} are not, but not which words fall into each category.
23
  \sQuote{for} are not, but not which words fall into each category.
24
 
24
 
25
  Generally words in all capitals are left alone: this implementation
25
  Generally words in all capitals are left alone: this implementation
26
  knows about conventional mixed-case words such as \sQuote{\I{LaTeX}} and
26
  knows about conventional mixed-case words such as \sQuote{\I{LaTeX}} and
Line 31... Line 31...
31
  quoted in titles.
31
  quoted in titles.
32
}
32
}
33
\value{
33
\value{
34
  A character vector of the same length as \code{text}, without names.
34
  A character vector of the same length as \code{text}, without names.
35
}
35
}
-
 
36
\examples{
-
 
37
toTitleCase("bayesian network modeling and analysis")
-
 
38
toTitleCase("ensemble tool for predictions from species distribution models")
-
 
39
## Treatment after "-":
-
 
40
toTitleCase("small- and large-scale analysis") # lowercase "and"
-
 
41
 
-
 
42
toTitleCase("a small fox is jumping")    # "a Small Fox is .."     (the 'a' may change)% i.e. BUG
-
 
43
toTitleCase("is a small fox jumping?")   # "Is a Small Fox .."     (fine)
-
 
44
## After ":", start a new sentence
-
 
45
toTitleCase("a pangram: the quick brown fox jumps over the lazy dog")
-
 
46
toTitleCase("asking -- 'is a small fox jumping?'") # ".. -- Is a Small ..."     (fine)
-
 
47
}