Strings And Byte Arrays : String and Byte Char Array « Data Type « VB.Net Tutorial






Public Class Tester
    Public Shared Sub Main
        Dim quote As String = "AAAAAasdfasdfasdfasdfasdfasdfasdfadsfasdfadsfads"
        Dim bytes() As Byte

        ' ----- Assumed to be all ASCII character.
        bytes = System.Text.Encoding.UTF8.GetBytes(quote)
        bytes(46) = 33    ' ASCII exclamation point
        Console.WriteLine(System.Text.Encoding.UTF8.GetString(bytes))

        ' ----- Works with all character sets.
        bytes = System.Text.Encoding.Unicode.GetBytes(quote)
        bytes(92) = 63    ' ASCII question mark
        bytes(93) = 0
        Console.WriteLine(System.Text.Encoding.Unicode.GetString(bytes))
    End Sub
End Class
AAAAAasdfasdfasdfasdfasdfasdfasdfadsfasdfadsfa!s
AAAAAasdfasdfasdfasdfasdfasdfasdfadsfasdfadsfa?s








2.28.String and Byte Char Array
2.28.1.Convert String to Char using System.Convert.ToChar
2.28.2.ToCharArray methods
2.28.3.Strings And Byte Arrays
2.28.4.String and char array
2.28.5.Reorder chars in a string
2.28.6.Loop through characters in string and display reversed
2.28.7.Use IndexOf to locate a character in a string
2.28.8.Use LastIndexOf to find a character in a string
2.28.9.Converts a substring within a string to an array of characters, then enumerates and displays the elements of the array.