Convert the surrogate pair in the string at index position zero to a code point. : Char « Data Types « VB.Net






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

1.Four ways to declare CharactersFour ways to declare Characters
2.Create a Console Line by Repeating a CharCreate a Console Line by Repeating a Char
3.Display contents of charArrayDisplay contents of charArray
4.Char IsDigitChar IsDigit
5.Char IsLetterChar IsLetter
6.Char IsLetterOrDigitChar IsLetterOrDigit
7.Char IsLowerChar IsLower
8.Char IsUpperChar IsUpper
9.Char ToUpperChar ToUpper
10.Char ToLowerChar ToLower
11.Char IsPunctuationChar IsPunctuation
12.Char IsSymbolChar IsSymbol
13.Insert char to StringBuilder
14.Generic and nongeneric versions of the CompareTo method for Char value
15.Char.IsLowSurrogate() IsHighSurrogate() and IsSurrogatePair()
16.Char ToString.
17.Char.IsDigitChar.IsDigit
18.demonstrates IsSymbol
19.Char.CompareTo (Object)
20.Char.ConvertFromUtf32 converts the specified Unicode code point into a UTF-16 encoded string.
21.Convert the lone UTF-16 character to a code point
22.Char.GetNumericValue converts numeric Unicode character to a double-precision floating point number.
23.Char.GetUnicodeCategory categorizes Unicode character into a group identified by one of the UnicodeCategory values.
24.Char.IsControl indicates whether the specified Unicode character is categorized as a control character.
25.Char.IsControl tells whether the character is categorized as a control character.
26.Char.IsDigit Method tells whether the specified Unicode character is categorized as a decimal digit.
27.Char.IsHighSurrogate Method tells whether the specified Char object is a high surrogate.
28.Is each of the following characters a high surrogate?
29.Is each of the following characters a low surrogate?
30.Characters a surrogate pair
31.Char.IsLetter Method tells whether the specified Unicode character is categorized as a Unicode letter.
32.Char.IsLower Method tells whether the specified Unicode character is categorized as a lowercase letter.
33.Char.IsNumber Method tells whether the specified Unicode character is categorized as a number.
34.Char.IsPunctuation Method tells whether the specified Unicode character is categorized as a punctuation mark.
35.Char.IsSeparator Method tells whether specified Unicode character is categorized as a separator character.
36.Char.IsSeparator Method (String, Int32) tells whether character at specified position is a separator character.
37.Char.IsSurrogate tells whether the specified character has a surrogate code point.
38.Char.IsSymbol Method tells whether the specified Unicode character is categorized as a symbol character.
39.Char.ToString converts Unicode character to string
40.Create a string from a character array
41.Is Surrogate Pair
42.Use Char.IsPunctuation and Char.IsWhiteSpace to split words
43.Char Structure