Skip to content

Instantly share code, notes, and snippets.

@odbol
Created April 22, 2014 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odbol/11194196 to your computer and use it in GitHub Desktop.
Save odbol/11194196 to your computer and use it in GitHub Desktop.
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