Convert the surrogate pair in the string at index position zero to a code point.
Class Sample
Public Shared Sub Main()
Dim letterA As Integer = &H41 'U+00041 = LATIN CAPITAL LETTER A
Dim music As Integer = &H1D161 'U+1D161 = MUSICAL SYMBOL SIXTEENTH NOTE
Dim s1 As String = music
music = [Char].ConvertToUtf32(s1, 0)
Show(s1)
Console.WriteLine(" => 0x{0:X}", music)
End Sub
Private Shared Sub Show(ByVal s As String)
Dim x As Integer
If s.Length = 0 Then Exit Sub
For x = 0 To s.Length - 1
Console.Write("0x{0:X}{1}", _
AscW(s.Chars(x)), _
IIf(x = s.Length - 1, [String].Empty, ", "))
Next
End Sub
End Class
Related examples in the same category