| 1 |
\name{repChar} |
| 2 |
\alias{repChar} |
| 3 |
\alias{bl.string} |
| 4 |
\title{Make Simple String from Repeating a Character, e.g. Blank String} |
| 5 |
\description{ |
| 6 |
Simple constructors of a constant character string from one character, |
| 7 |
notably a \dQuote{blank} string of given string length. |
| 8 |
|
| 9 |
M.M. is now \sQuote{\emph{mentally deprecating}} \code{bl.string} in |
| 10 |
favor of using \code{repChar()} in all cases. |
| 11 |
|
| 12 |
With \R 3.3.0 (May 2016), the \emph{new} function |
| 13 |
\code{\link{strrep}()} was introduced; it is faster typically, and more |
| 14 |
flexible, e.g. accepting a \emph{vector} for the 2nd argument. |
| 15 |
\cr |
| 16 |
This (for now informally) deprecates all uses of \code{repChar()} and \code{bl.string()}. |
| 17 |
} |
| 18 |
\usage{ |
| 19 |
repChar(char, no) |
| 20 |
bl.string(no) |
| 21 |
} |
| 22 |
\arguments{ |
| 23 |
\item{char}{single character (or arbitrary string).} |
| 24 |
\item{no}{non-negative integer.} |
| 25 |
} |
| 26 |
\value{ |
| 27 |
One string, i.e., \code{\link{character}(1)}), for \code{bl.string} a |
| 28 |
blank string, fulfilling \code{n == nchar(bl.string(n))}. |
| 29 |
} |
| 30 |
\author{Martin Maechler, early 1990's (for \code{bl.string}).} |
| 31 |
\seealso{\code{\link{paste}}, \code{\link{character}}, \code{\link{nchar}}.} |
| 32 |
\examples{ |
| 33 |
r <- sapply(0:8, function(n) ccat(repChar(" ",n), n)) |
| 34 |
cbind(r) |
| 35 |
|
| 36 |
repChar("-", 4) |
| 37 |
repChar("_", 6) |
| 38 |
## it may make sense to a string of more than one character: |
| 39 |
repChar("-=- ", 6) |
| 40 |
|
| 41 |
## show the very simple function definitions: |
| 42 |
repChar |
| 43 |
bl.string |
| 44 |
} |
| 45 |
\keyword{character} |