How do I convert an ASCII hex string into a character?
Examples:
6E - n
26 - &
45 - E
I have searched on the internet but only found answers for the decimal system, not the double-hex format.
Use a combination of parseInt()
and String.fromCharCode()
:
const hex2Char = hex => String.fromCharCode(parseInt(hex, 16));
console.log(hex2Char('6E'));
console.log(hex2Char('26'));
console.log(hex2Char('45'));