Skip to content

Instantly share code, notes, and snippets.

@comoc
Last active October 27, 2017 12:56
Show Gist options
  • Save comoc/836927927eb1b3183d7b0c3bf2727788 to your computer and use it in GitHub Desktop.
Save comoc/836927927eb1b3183d7b0c3bf2727788 to your computer and use it in GitHub Desktop.
ASCII文字の16進表現の値を調べる各種の方法 ref: http://qiita.com/comocc/items/0dab7f5aac9dc7e43d07
#include <stdio.h>
int main(void)
{
printf("%x\n", '\n');
return 0;
}
#include <iostream>
int main()
{
std::cout << std::hex << static_cast<int>('\n') << std::endl;
return 0;
}
$ man ascii
$ node
> console.log('\n'.charCodeAt(0).toString(16));
a
$ ruby -e 'p "\n".ord.to_s(16)'
"a"
$ python -c "print(hex(ord('\n')))"
0xa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment