Skip to content

Instantly share code, notes, and snippets.

@odbol
Created April 22, 2014 21:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Parse hex string and redisplay as base 10 and character equivalents.
var str = "90036F4920203080030049202030",
res = [];
for (var i = 0; i < str.length; i += 2) {
var hex = str.substr(i, 2),
num = parseInt(hex, 16),
char = String.fromCharCode(num)
pr = hex + "\t" + num + "\t" + char + "\n";
res.push(pr);
console.log (pr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment