G
Guest
I'd like to display a byte as a hex, using C# String.Format() function. I
also would like for the number to have a leading 0 if it's represented by
one digit only.
byte bt1 = 0x09;
byte bt2 = 0x0A;
Console.WriteLine(String.Format("{0:00}", bt1)); // displays 09, but it's a
decimal
Console.WriteLine(String.Format("{0:X}", bt2)); // displays A, but without
the leading 0
How can I combine these two formatters?
Thanks,
VR
also would like for the number to have a leading 0 if it's represented by
one digit only.
byte bt1 = 0x09;
byte bt2 = 0x0A;
Console.WriteLine(String.Format("{0:00}", bt1)); // displays 09, but it's a
decimal
Console.WriteLine(String.Format("{0:X}", bt2)); // displays A, but without
the leading 0
How can I combine these two formatters?
Thanks,
VR