C# Programming
07-12-2009, 06:30 PM
hi,
i need to convert an ascii byte array to string.
in the byte [] could be 0 value that marks the end of the string.
i tried to do it like that :
byte[] test = { 0x41, 0x42, 0 };
string mystr = ASCIIEncoding.ASCII.GetString(test);
but the result is - "AB\0"
can i do it otherway to get just "AB" ?
thanks,
Samy
i need to convert an ascii byte array to string.
in the byte [] could be 0 value that marks the end of the string.
i tried to do it like that :
byte[] test = { 0x41, 0x42, 0 };
string mystr = ASCIIEncoding.ASCII.GetString(test);
but the result is - "AB\0"
can i do it otherway to get just "AB" ?
thanks,
Samy