开发者

Get string value from a byte string

I have to get the value from byte string this is the byte string

4W3CfJ//nw1CpeA5NfXx9Ia32JyVmgpRrQCzUabFUvv0fqXYLVeNBT6XKjBehFNGtQ3Sng3Zucqu+RcXUzJ3KA==开发者_C百科

now how can I get the value from it


Its an Base64 Encoded string you will need to get back the UnEncoded string like this:

 byte[] b = Convert.FromBase64String("your base 64 string==");

 originalString = System.Text.Encoding.UTF8.GetString(b);


Use

Byte[] bytes = Convert.FromBase64String(myString);


Look into encoding, but it might be as simple as

YourString = Encoding.ASCII.GetBytes( YourByteArrayString );


If the byte array is an UTF encoded byte array it can be converted using

UTF8Encoding encoder = new UTF8Encoding(); 
encoder.GetString(bytes);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜