Calculates number of characters produced by decoding a sequence of bytes from the specified byte array.
Imports System
Imports System.Text
Imports System.Net.Sockets
Class UTF8EncodingExample
Public Shared Sub Main()
Dim bytes() As Byte = { _
85, 84, 70, 56, 32, 69, 110, _
69, 120, 97, 109, 112, 108, 101 _
}
Dim utf8 As New UTF8Encoding()
Dim charCount As Integer = utf8.GetCharCount(bytes, 2, 8)
Console.WriteLine(charCount)
End Sub
End Class
Related examples in the same category