| Line 1... |
Line 1... |
| 1 |
% File src/library/base/man/strtoi.Rd
|
1 |
% File src/library/base/man/strtoi.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 2009-10 R Core Team
|
3 |
% Copyright 2009-2010 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{strtoi}
|
6 |
\name{strtoi}
|
| 7 |
\alias{strtoi}
|
7 |
\alias{strtoi}
|
| 8 |
\title{Convert Strings to Integers}
|
8 |
\title{Convert Strings to Integers}
|
| Line 21... |
Line 21... |
| 21 |
Conversion is based on the C library function \code{strtol}.
|
21 |
Conversion is based on the C library function \code{strtol}.
|
| 22 |
|
22 |
|
| 23 |
For the default \code{base = 0L}, the base chosen from the string
|
23 |
For the default \code{base = 0L}, the base chosen from the string
|
| 24 |
representation of that element of \code{x}, so different elements can
|
24 |
representation of that element of \code{x}, so different elements can
|
| 25 |
have different bases (see the first example). The standard C rules
|
25 |
have different bases (see the first example). The standard C rules
|
| 26 |
for choosing the base are that octal constants (prefix \code{0} not
|
26 |
for choosing the base are that octal constants (prefix \samp{0} not
|
| 27 |
followed by \code{x} or \code{X}) and hexadecimal constants (prefix
|
27 |
followed by \samp{x} or \samp{X}) and hexadecimal constants (prefix
|
| 28 |
\code{0x} or \code{0X}) are interpreted as base \code{8} and
|
28 |
\samp{0x} or \samp{0X}) are interpreted as base \code{8} and
|
| 29 |
\code{16}; all other strings are interpreted as base \code{10}.
|
29 |
\code{16}; all other strings are interpreted as base \code{10}.
|
| 30 |
|
30 |
|
| 31 |
For a base greater than \code{10}, letters \code{a} to \code{z} (or
|
31 |
For a base greater than \code{10}, letters \samp{a} to \samp{z} (or
|
| 32 |
\code{A} to \code{Z}) are used to represent \code{10} to \code{35}.
|
32 |
\samp{A} to \samp{Z}) are used to represent \code{10} to \code{35}.
|
| 33 |
}
|
33 |
}
|
| 34 |
\value{
|
34 |
\value{
|
| 35 |
An integer vector of the same length as \code{x}. Values which cannot
|
35 |
An integer vector of the same length as \code{x}. Values which cannot
|
| 36 |
be interpreted as integers or would overflow are returned as
|
36 |
be interpreted as integers or would overflow are returned as
|
| 37 |
\code{\link{NA_integer_}}.
|
37 |
\code{\link{NA_integer_}}.
|