Hi
How to convert from Hex String to ASCII string in javascript ??
Ex: 32343630 it will be 2460
Thanks alot..
Hi
How to convert from Hex String to ASCII string in javascript ??
Ex: 32343630 it will be 2460
Thanks alot..
function hex2a(hex) {
var str = '';
for (var i = 0; i < hex.length; i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
return str;
}
hex2a('32343630'); // returns '2460'
Here is working demo with ready to use function
http://www.java2s.com/Code/JavaScript/Security/AsciitoHexandHextoAsciiinJavaScript.htm
and the working demo
http://www.java2s.com/Code/JavaScriptDemo/AsciitoHexandHextoAsciiinJavaScript.htm