Logo

Programming-Idioms

History of Idiom 22 > diff from v55 to v56

Edit summary for version 56 by programming-idioms.org:
[Java] Less whitespace

Version 55

2016-11-27, 14:41:52

Version 56

2016-11-27, 14:43:55

Idiom #22 Convert string to integer

Extract integer value i from its string representation s (in radix 10)

Illustration

Idiom #22 Convert string to integer

Extract integer value i from its string representation s (in radix 10)

Illustration
Extra Keywords
int base
Extra Keywords
int base
Code
int i = new Integer( s ).intValue();
Code
int i = new Integer(s).intValue();
Comments bubble
This will throw NumberFormatException if s does not contain a parsable integer
Comments bubble
This will throw NumberFormatException if s does not contain a parsable integer
Doc URL
https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#Integer%28java.lang.String%29
Doc URL
https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#Integer%28java.lang.String%29