Imports System
Imports Microsoft.VisualBasic
Class Sample
Public Shared Sub Main()
Dim cHigh As Char = ChrW(&HD800)
Dim cLow As Char = ChrW(&HDC00)
Dim s1 = New [String](New Char() {"a"c, ChrW(&HD800), ChrW(&HDC00), "z"c})
Console.WriteLine("{0:X4}", AscW(cHigh))
Console.WriteLine("{0:X4}", AscW(cLow))
Dim i As Integer
For i = 0 To s1.Length - 1
Console.WriteLine("s1({0}) = {1:X4} ", i, AscW(s1.Chars(i)))
Next i
Console.WriteLine([Char].IsHighSurrogate(cLow))
Console.WriteLine([Char].IsHighSurrogate(cHigh))
Console.WriteLine([Char].IsHighSurrogate(s1, 0))
Console.WriteLine([Char].IsHighSurrogate(s1, 1))
Console.WriteLine([Char].IsLowSurrogate(cLow))
Console.WriteLine([Char].IsLowSurrogate(cHigh))
Console.WriteLine([Char].IsLowSurrogate(s1, 0))
Console.WriteLine([Char].IsLowSurrogate(s1, 2))
Console.WriteLine([Char].IsSurrogatePair(cHigh, cLow))
Console.WriteLine([Char].IsSurrogatePair(s1, 0))
Console.WriteLine([Char].IsSurrogatePair(s1, 1))
Console.WriteLine([Char].IsSurrogatePair(s1, 2))
End Sub
End Class
|