Skip to content

Instantly share code, notes, and snippets.

@awn-git
Last active December 29, 2016 20:06
Show Gist options
  • Save awn-git/4c11c82c1e433f10af08f2979c740cd0 to your computer and use it in GitHub Desktop.
Save awn-git/4c11c82c1e433f10af08f2979c740cd0 to your computer and use it in GitHub Desktop.
文字列をいい感じに調べるスニペット
function searchUnicode(strs){
let charcodes = strs.split("").map((s) => {return s.charCodeAt();});
let charhex = charcodes.map((s) => {return s.toString(16);});
for(let ix = 0, len = charcodes.length; ix < len; ix++){
console.log(`${strs[ix]} = ${charcodes[ix]}(U+${charhex[ix]}): http://www.fileformat.info/info/unicode/char/${charhex[ix]}/index.htm`);
}
return [charcodes, charhex];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment