开发者

converting from byte[] to string [duplicate]

开发者 https://www.devze.com 2023-01-07 16:49 出处:网络
This question already has answers here: Closed 1开发者_运维百科2 years ago. Possible Duplicate: Converting from byte[] to string
This question already has answers here: Closed 1开发者_运维百科2 years ago.

Possible Duplicate:

Converting from byte[] to string

How to convert from byte[] to string when we are importing a excel .?


string myString =System.Text.Encoding.UTF8.GetString(myByteArray);


Encoding.Default.GetString(yourbytearray)


byte[] b = new byte[100];
string ascii_string = System.Text.ASCIIEncoding.ASCII.GetString(b); // For ascii string
string uni_string = System.Text.Encoding.UTF8.GetString(b); // For Unicode String


That's be the Encoding namespaces.

For example this method takes a byte array and returns a string

return System.Text.Encoding.UTF8.GetString(byteArray);
0

精彩评论

暂无评论...
验证码 换一张
取 消