Skip to content
Reference > Methods

parseInt(num,radix)

Definition

Integer parseInt(String num, Number radix)

Description

Converts num of base radix into base 10

Parameter Definition

Name Type Description
num String String representation of the number to be convereted to base 10
radix Number Base of num. Supported bases are 2, 8, 10, 16.

Examples

1
2
3
4
Integer r1 = parseInt("0xab",16); // r1 == 171
Integer r2 = parseInt("-70ab",16); // r2 == -28843
Integer r3 = parseInt("171",8); // r3 == 121
Integer r4 = parseInt("10001011",2); // r4 == 139