Sep 16, 2003 #1 W Worrow Regular Joined Jul 10, 2003 Messages 68 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 P PlausiblyDamp Administrator Joined Sep 4, 2002 Messages 6,471 Location Lancashire, UK given an array of bytes held in b() somethging similar to the following should work Visual Basic: 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 Visual Basic: 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 Ultimate Contributor Joined Jan 19, 2003 Messages 1,771 Location Enfield, CT, USA You could also do something like this: Visual Basic: 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: Visual Basic: 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".