Logo

Programming-Idioms

History of Idiom 22 > diff from v31 to v32

Edit summary for version 32 by :
[Java] +DocURL

Version 31

2015-12-30, 21:28:32

Version 32

2015-12-30, 21:31:10

Idiom #22 Convert string to integer

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

Idiom #22 Convert string to integer

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

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