Integer.parseInt(s, radix)
来源:互联网 发布:oracle连接mysql详解 编辑:程序博客网 时间:2024/05/17 23:51
parseInt
public static int parseInt(String s,int radix) throws NumberFormatException
Parses the string argument as a signed integer in the radix specified by the second argument. The characters in the string must all be digits of the specified radix (as determined by whetherCharacter.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 integer value is returned.An exception of type
NumberFormatException
is thrown if any of the following situations occurs:- The first argument is
null
or is a string of length zero. - The radix is either smaller than
Character.MIN_RADIX
or larger thanCharacter.MAX_RADIX
. - Any character of the string is not a digit of the specified radix, except that the first character may be a minus sign
'-'
('\u002D'
) or plus sign'+'
('\u002B'
) provided that the string is longer than length 1. - The value represented by the string is not a value of type
int
.
Examples:
parseInt("0", 10) returns 0 parseInt("473", 10) returns 473 parseInt("+42", 10) returns 42 parseInt("-0", 10) returns 0 parseInt("-FF", 16) returns -255 parseInt("1100110", 2) returns 102 parseInt("2147483647", 10) returns 2147483647 parseInt("-2147483648", 10) returns -2147483648 parseInt("2147483648", 10) throws a NumberFormatException parseInt("99", 8) throws a NumberFormatException parseInt("Kona", 10) throws a NumberFormatException parseInt("Kona", 27) returns 411787
- Parameters:
s
- theString
containing the integer representation to be parsedradix
- the radix to be used while parsings
.- Returns:
- the integer represented by the string argument in the specified radix.
- Throws:
NumberFormatException
- if theString
does not contain a parsableint
.
- The first argument is
0 0
- Integer.parseInt(s, radix)
- Integer.parseInt(String s,int radix)
- Integer.parseInt(String s ,int radix)方法使用解释
- Integer.parseInt(String s ,int radix)方法使用解释
- Integer.parseInt(String s, int radix)的用法
- Integer.parseInt(String s ,int radix)方法使用解释!
- Integer.parseInt(String s, int radix)方法介绍(修正版)
- 关于Integer的parseInt(String s, int radix)方法的使用
- java基础之Integer.parseInt(String s ,int radix)方法使用解释
- 关于Integer的parseInt(String s, int radix)方法的使用
- 关于Integer的parseInt(String s, int radix)方法的使用
- java基础之Integer.parseInt(String s ,int radix)方法使用解释
- java基础之Integer.parseInt(String s ,int radix)方法使用解释
- 【java学习笔记(零散知识点)】Integer类 parseInt(String s ,int radix)方法
- int parseInt(String s, int radix)
- 详解public static int parseInt(String s, int radix)
- Integer.valueof(String s)与Integer.parseInt(String s)区别
- Integer.valueOf(String s)与Integer.parseInt(String s)区别
- 124. Binary Tree Maximum Path Sum Leetcode Python
- 4Sum
- Valid Palindrome Leetcode Python
- LeetCode(127) Word Ladder
- Longest Consecutive Sequence Leetcode Python
- Integer.parseInt(s, radix)
- 位运算
- (XCTest.h file not found)cocoapods引入Specta库之后报XCTest.h文件无法找到
- Git book 读书笔记 (二) -- 创建自己的仓库
- Python 使用nltk获取TF-IDF
- 好老师,什么样?
- Implement strStr()
- 《人人都想当经理》--自序
- 多态