|
I assume you mean decimal to hex… Decimal (base 10) Hexadecimal (base 16) Binary (base 2) Anyway, something like this might work: static string DecToHex(int number) { return string.Format(“{0:X}”,
number); } string hex = DecToHex(108); hex would equal “6C”. using “{0:x}” as the format
string would produce “6c”. using “{0,4:X}” as the format
string would produce “ 6C” (two spaces). You could then
replace all spaces to zeros like this: static string DecToHex(int number) { return string.Format(“0x{0,4:X}”,
number).Replace(“ “, “0”); } which would produce “0x006C”. I hope this helps! From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Shawn Haigh Greetings, Does anyone out there have a neat function to
convert a binary number to its hex equivalent? Ex; 108 to
0x006C cheers Shawn Haigh |
RE: [Nant-users] bin 2 hex
Castro, Edwin Gabriel (Firing Systems Engr.) Thu, 18 Nov 2004 11:33:24 -0800
- RE: [Nant-users] bin 2 hex Castro, Edwin Gabriel (Firing Systems Engr.)
- RE: [Nant-users] bin 2 h... Shawn Haigh
