Here is the vim editor's way to convert between hexadecimal number system to decimal number system and vice versa.
In the vim editor's command mode, type
(a) Hexadecimal to decimal
:echo 0x111
273
(or)
:echo printf ('%d',0x111)
(b) Decimal to hexadecimal
:echo printf ('%x', 273)
111
Corollary:
1. If you use, %X instead of %x then the numbers will be displayed in uppercase.
2. you can even perform arithmetic like the way below.
:echo printf ('%x',273-173)
64
:echo 0x111-0x10
257
No comments:
Post a Comment