Byte Array to string ?

CdRsKuLL

Active member
Joined
Sep 26, 2006
Messages
40
Programming Experience
Beginner
Hi peeps.. I was wondering if someone could help me.

I'm trying to read a byte array into a string however it's array is filling up from a dll in the following format..

[83][0][105][0][114][0][32][0][74][0][105][0][109][0][109][0][121][0][32][0][89][0][111][0][117][0][110][0][103][0][32][0][97][0][116][0][32][0][57][0][48][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]

now its decoding the first byte but I think because of the next [0] it's not completing the whole array.

This is the code that I'm using...

Radiotext = System.Text.Encoding.ASCII.GetString(szRetRDS)

I did think about writing it into another byte array excluding the [0] but unsure how I would go about this.

Any help would be much appreciated.

thanks

Steve
 
sorted it.. changed it to unicode format and then replaced all the space in the convert string with nothing :)

stringfound.Replace(Chr(0), String.Empty)

Job done.

thanks

Steve
 
Ascii encoding is an 8bit (a byte) encoding, and that looks like a 16bit encoding (two bytes each char). I would use Encoding.Unicode.GetString if I knew no better. No extraneous spaces show, by the way.
 
Back
Top