VB strings seem to be binary safe

Code to test it:

Dim s1 As String = “”

        For i As Integer = 0 To 255
            Dim hexI As String = Hex(i)
            If hexI.Length = 1 Then
                hexI = “0” + hexI
            End If

            s1 = s1 + System.Text.RegularExpressions.Regex.Unescape(“\x” + hexI)
        Next

        For i2 As Integer = 0 To 255

            RichTextBox1.AppendText(Hex(Microsoft.VisualBasic.AscW(s1(i2))) + vbNewLine)
        Next

I didn’t check all values, but all values that could be used as delimiters(\x00 for instance) seem retrievable. Also, notepad tells me the richtextbox has 256 lines(plus one empty at the end).

You need a form and a richtextbox for this code(the code is public domain btw)

Advertisements

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s