GetCharCount returns the number of characters produced by decoding a range of elements in a byte array using UnicodeEncoding. : UTF8Encoding « Development « VB.Net Tutorial






Imports System
Imports System.Text

Class UnicodeEncodingExample

    Public Shared Sub Main()
        Dim bytes() As Byte = {5, 0, 10, 0, 15, 0, 99, 0, 111, 0, 100, 0, 101, 0}

        Dim uni As New UnicodeEncoding()
        Dim charCount As Integer = uni.GetCharCount(bytes, 2, 8)
        Console.WriteLine("{0} characters needed to decode bytes.", charCount)
    End Sub
End Class








7.32.UTF8Encoding
7.32.1.Create a new UTF8Encoding
7.32.2.GetChars method decodes a range of elements in a byte array and store the result in a character array.
7.32.3.GetCharCount returns the number of characters produced by decoding a range of elements in a byte array using UnicodeEncoding.
7.32.4.Use an encoder and a decoder to encode a string into an array of bytes, and then decode the bytes into an array of characters.