Sep 16, 2003 #1 W Worrow Well-known member Joined Jul 10, 2003 Messages 67 Is there any way to convert an array of byte to string without making several chrw() call? Thanks in advance.
Is there any way to convert an array of byte to string without making several chrw() call? Thanks in advance.
Sep 16, 2003 #2 PlausiblyDamp Administrator Joined Sep 4, 2002 Messages 6,155 Location Lancashire, UK User Rank *Expert* given an array of bytes held in b() somethging similar to the following should work Code: Imports System.IO Dim ms as new MemoryStream(b) dim sr as new StreamReader(ms) dim s as string = sr.ReadToEnd()
given an array of bytes held in b() somethging similar to the following should work Code: Imports System.IO Dim ms as new MemoryStream(b) dim sr as new StreamReader(ms) dim s as string = sr.ReadToEnd()
Sep 16, 2003 #3 M mutant Well-known member Joined Jan 19, 2003 Messages 1,771 Location Enfield, CT, USA User Rank *Expert* You could also do something like this: Code: Dim b(3) As Byte b(1) = 97 b(2) = 97 b(3) = 97 b(0) = 97 Dim s As String = System.Text.ASCIIEncoding.ASCII.GetString(b) Now s will contain "aaaa".
You could also do something like this: Code: Dim b(3) As Byte b(1) = 97 b(2) = 97 b(3) = 97 b(0) = 97 Dim s As String = System.Text.ASCIIEncoding.ASCII.GetString(b) Now s will contain "aaaa".