함수 dechex()

(Dechex에서 넘어옴)


1 개요[ | ]

hex
dechex()
.toHexString()
  • decimal to hexadecimal
  • 10진수 → 16진수

2 Bash[ | ]

printf "%x\n" 10    # a
printf "%x\n" 47    # 2f
printf "%x\n" 65535 # ffff
result=$(printf %x 65535)
echo $result # ffff
echo "obase=16; 10" | bc
# A
echo "obase=16; 47" | bc
# 2F
echo "obase=16; 65535" | bc
# FFFF

3 Java[ | ]

System.out.println( Integer.toHexString(10) );
System.out.println( Integer.toHexString(47) );
System.out.println( Integer.toHexString(65535) );
// a
// 2f
// ffff
System.out.println( Long.toHexString(4294967295L) );
System.out.println( Long.toHexString(1234567890123456L) );
// ffffffff
// 462d53c8abac0

4 PHP[ | ]

echo dechex(10)    . "\n"; # a
echo dechex(47)    . "\n"; # 2f
echo dechex(65535) . "\n"; # ffff

5 Python[ | ]

print( hex(10) )    # 0xa
print( hex(47) )    # 0x2f
print( hex(65535) ) # 0xffff

6 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}