Click to See Complete Forum and Search --> : hex numbers (unicode) to String


Lobo
December 17th, 2002, 09:27 AM
Hi,

1. I want to convert some Hex numbers which contain unicode vallues into a string, Say, I have

0x0 0x0 0x4 0x2 which means "b" (I think)

I want to get a string containing "b".

I tried this:
-------------------------------------------
byte[] b = {0x0, 0x0 ,0x4 ,0x2};

System.Text.Encoding u = new System.Text.UnicodeEncoding();

string h = u.GetString(b);
--------------------------------------------

but the returned string equals "".

2. How can I convert an int or such to a hex-String ? Like I have int i = 0; and I want to get a string containing "0x0".


Thanks for you time !

regards, Lobo

TheCPUWizard
December 17th, 2002, 09:34 AM
Multi byte numbers are stored LittleEndian on PCs!

Lobo
December 17th, 2002, 09:59 AM
Thanks, the problem was the bytearray (not 0x4, 0x2 but 0x42).

Thanks anyway!