convert Byte array to string and vice veras 
Author Message
 convert Byte array to string and vice veras

How do I convert a String to an array of Bytes and vice versa???

Thanks.



Wed, 15 Sep 2004 09:16:45 GMT  
 convert Byte array to string and vice veras
Emad,

Please don't crosspost.

Quote:
>How do I convert a String to an array of Bytes and vice versa???

Use the appropriate System.Text.Encoding derived class, depending on
how you want the text encoded.

Mattias

===
Mattias Sj?gren (VB MVP)

http://www.msjogren.net/dotnet/



Wed, 15 Sep 2004 11:01:06 GMT  
 convert Byte array to string and vice veras
you could do (from string to byte array):
        Dim b() As Byte
        Dim utf As New System.Text.UTF7Encoding()
        b = utf.GetBytes("hello world")
and (from byte array to string):
        Dim s As String = utf.GetString(b)
        Console.WriteLine("and string is {0}", s)


Quote:
> How do I convert a String to an array of Bytes and vice versa???

> Thanks.



Thu, 16 Sep 2004 08:17:17 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HELP: How to convert a byte array into a string, and vice versa

2. Byte Array to String and Vice Versa?

3. Converting string array to byte array

4. Need to convert a 16 byte array of bytes to 4 byte integer

5. Converting character to byte and vice versa

6. Converting from string to array of bytes

7. Convert integers and strings to byte array

8. Convert Byte Array to a String

9. Converting between String and Byte Array

10. Convert Strings to Byte arrays and back

11. Convert a string to byte array

12. Convert an array of bytes to a string

 

 
Powered by phpBB® Forum Software