Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to convert a hex string to hex number


const hexToDecimal = hex => parseInt(hex, 16);

const dec1 = hexToDecimal("2");
const dec2 = hexToDecimal("35");
const dec3 = hexToDecimal("1f4");
const dec4 = hexToDecimal("7b2");
const dec5 = hexToDecimal("123abc");

console.log(dec1); // 2
console.log(dec2); // 53
console.log(dec3); // 500
console.log(dec4); // 1970
console.log(dec5); // 1194684
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #How #convert #hex #string #hex #number
ADD COMMENT
Topic
Name
6+3 =