public class Jdk9CharSequenceParsers extends Object
| Constructor and Description |
|---|
Jdk9CharSequenceParsers() |
| Modifier and Type | Method and Description |
|---|---|
static int |
parseInt(CharSequence s,
int beginIndex,
int endIndex,
int radix)
Parses the
CharSequence argument as a signed int in the specified radix, beginning at the
specified beginIndex and extending to endIndex - 1. |
static long |
parseLong(CharSequence s,
int beginIndex,
int endIndex,
int radix)
Parses the
CharSequence argument as a signed long in the specified radix, beginning at
the specified beginIndex and extending to endIndex - 1. |
static short |
parseShort(CharSequence s,
int beginIndex,
int endIndex,
int radix)
Parses the string argument as a signed
short in the radix specified by the second argument. |
public static int parseInt(CharSequence s, int beginIndex, int endIndex, int radix) throws NumberFormatException
CharSequence argument as a signed int in the specified radix, beginning at the
specified beginIndex and extending to endIndex - 1.
The method does not take steps to guard against the CharSequence being mutated while parsing.
s - the CharSequence containing the int representation to be parsedbeginIndex - the beginning index, inclusive.endIndex - the ending index, exclusive.radix - the radix to be used while parsing s.int represented by the subsequence in the specified radix.NullPointerException - if s is null.IndexOutOfBoundsException - if beginIndex is negative, or if beginIndex is greater than endIndex or if
endIndex is greater than s.length().NumberFormatException - if the CharSequence does not contain a parsable int in the specified radix,
or if radix is either smaller than Character.MIN_RADIX or larger than
Character.MAX_RADIX.public static long parseLong(CharSequence s, int beginIndex, int endIndex, int radix) throws NumberFormatException
CharSequence argument as a signed long in the specified radix, beginning at
the specified beginIndex and extending to endIndex - 1.
The method does not take steps to guard against the CharSequence being mutated while parsing.
s - the CharSequence containing the long representation to be parsedbeginIndex - the beginning index, inclusive.endIndex - the ending index, exclusive.radix - the radix to be used while parsing s.long represented by the subsequence in the specified radix.NullPointerException - if s is null.IndexOutOfBoundsException - if beginIndex is negative, or if beginIndex is greater than endIndex or if
endIndex is greater than s.length().NumberFormatException - if the CharSequence does not contain a parsable int in the specified radix,
or if radix is either smaller than Character.MIN_RADIX or larger than
Character.MAX_RADIX.public static short parseShort(CharSequence s, int beginIndex, int endIndex, int radix) throws NumberFormatException
short in the radix specified by the second argument. The
characters in the string must all be digits, of the specified radix (as determined by whether
Character.digit(char, int) returns a nonnegative value) except that the first character may be
an ASCII minus sign '-' ('\u002D') to indicate a negative value or an ASCII plus sign
'+' ('\u002B') to indicate a positive value. The resulting short value is returned.
An exception of type NumberFormatException is thrown if any of the following situations occurs:
null or is a string of length zero.
Character.MIN_RADIX or larger than
Character.MAX_RADIX.
'-' ('\u002D') or plus sign '+' ('\u002B') provided that the
string is longer than length 1.
short.
s - the String containing the short representation to be parsedradix - the radix to be used while parsing sshort represented by the string argument in the specified radix.NumberFormatException - If the String does not contain a parsable short.Copyright © 2014–2017 Pivotal Software, Inc.. All rights reserved.