Skip to content

Instantly share code, notes, and snippets.

@sgqy
Created October 30, 2018 18:22
Show Gist options
  • Save sgqy/c9bb73cde3e631dc0cc14bda207c78a7 to your computer and use it in GitHub Desktop.
Save sgqy/c9bb73cde3e631dc0cc14bda207c78a7 to your computer and use it in GitHub Desktop.
function dump_str(str) {
for (let i = 0; i < str.length; ++i) {
if (i % 16 === 0) {
console.log('');
process.stdout.write(('00000' + i.toString(16)).slice(-6) + ' |');
}
const _ = ('0' + str.charCodeAt(i).toString(16)).slice(-2);
process.stdout.write(' ' + _);
}
console.log('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment