"함수 dechex()"의 두 판 사이의 차이

43번째 줄: 43번째 줄:


==PHP==
==PHP==
{{참고|PHP dechex()}}
[[category: PHP]]
[[category: PHP]]
<source lang='PHP'>
<source lang='PHP'>

2017년 4월 12일 (수) 15:44 판

1 개요

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

2 Bash

printf %x 10
# a
printf %x 47
# 2f
printf %x 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

4 PHP

echo dechex(10);
echo dechex(47);
echo dechex(65535);
# a
# 2f
# ffff

5 Python

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

6 같이 보기

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