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

8번째 줄: 8번째 줄:
[[category: Bash]]
[[category: Bash]]
<source lang='Bash'>
<source lang='Bash'>
result=`printf %x 10`
printf %x 10
echo $result
# a
# a
</source>
<source lang='Bash'>
printf %x 47
printf %x 47
# 2f
# 2f
printf %x 65535
# ffff
</source>
</source>
<source lang='Bash'>
<source lang='Bash'>

2015년 10월 15일 (목) 01:38 판

1 개요

hex
dechex
  • 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

3 PHP

echo dechex(10); // a
echo dechex(47); // 2f

4 Python

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

5 같이 보기

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