當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET CharUnicodeInfo.GetNumericValue方法代碼示例

本文整理匯總了VB.NET中System.Globalization.CharUnicodeInfo.GetNumericValue方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET CharUnicodeInfo.GetNumericValue方法的具體用法?VB.NET CharUnicodeInfo.GetNumericValue怎麽用?VB.NET CharUnicodeInfo.GetNumericValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Globalization.CharUnicodeInfo的用法示例。


在下文中一共展示了CharUnicodeInfo.GetNumericValue方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: Main

' 導入命名空間
Imports System.Globalization

Public Class SamplesCharUnicodeInfo   

   Public Shared Sub Main()

      Console.WriteLine("                                        c  Num   Dig   Dec   UnicodeCategory")

      Console.Write("U+0061 LATIN SMALL LETTER A            ")
      PrintProperties("a"c)

      Console.Write("U+0393 GREEK CAPITAL LETTER GAMMA      ")
      PrintProperties(ChrW(&H0393))

      Console.Write("U+0039 DIGIT NINE                      ")
      PrintProperties("9"c)

      Console.Write("U+00B2 SUPERSCRIPT TWO                 ")
      PrintProperties(ChrW(&H00B2))

      Console.Write("U+00BC VULGAR FRACTION ONE QUARTER     ")
      PrintProperties(ChrW(&H00BC))

      Console.Write("U+0BEF TAMIL DIGIT NINE                ")
      PrintProperties(ChrW(&H0BEF))

      Console.Write("U+0BF0 TAMIL NUMBER TEN                ")
      PrintProperties(ChrW(&H0BF0))

      Console.Write("U+0F33 TIBETAN DIGIT HALF ZERO         ")
      PrintProperties(ChrW(&H0F33))

      Console.Write("U+2788 CIRCLED SANS-SERIF DIGIT NINE   ")
      PrintProperties(ChrW(&H2788))

   End Sub

   Public Shared Sub PrintProperties(c As Char)
      Console.Write(" {0,-3}", c)
      Console.Write(" {0,-5}", CharUnicodeInfo.GetNumericValue(c))
      Console.Write(" {0,-5}", CharUnicodeInfo.GetDigitValue(c))
      Console.Write(" {0,-5}", CharUnicodeInfo.GetDecimalDigitValue(c))
      Console.WriteLine("{0}", CharUnicodeInfo.GetUnicodeCategory(c))
   End Sub

End Class


'This code produces the following output.  Some characters might not display at the console.
'
'                                        c  Num   Dig   Dec   UnicodeCategory
'U+0061 LATIN SMALL LETTER A             a   -1    -1    -1   LowercaseLetter
'U+0393 GREEK CAPITAL LETTER GAMMA       \u0393   -1    -1    -1   UppercaseLetter
'U+0039 DIGIT NINE                       9   9     9     9    DecimalDigitNumber
'U+00B2 SUPERSCRIPT TWO                  \u00B2   2     2     2    OtherNumber
'U+00BC VULGAR FRACTION ONE QUARTER      \u00BC   0.25  -1    -1   OtherNumber
'U+0BEF TAMIL DIGIT NINE                 \u0BEF   9     9     9    DecimalDigitNumber
'U+0BF0 TAMIL NUMBER TEN                 \u0BF0   10    -1    -1   OtherNumber
'U+0F33 TIBETAN DIGIT HALF ZERO          \u0F33   -0.5  -1    -1   OtherNumber
'U+2788 CIRCLED SANS-SERIF DIGIT NINE    \u2788   9     9     -1   OtherNumber
開發者ID:VB.NET開發者,項目名稱:System.Globalization,代碼行數:61,代碼來源:CharUnicodeInfo.GetNumericValue

示例2:

Dim utf32 As Integer = &h10107       ' AEGEAN NUMBER ONE
Dim surrogate As String = Char.ConvertFromUtf32(utf32)
For Each ch In surrogate
   Console.WriteLine("U+{0:X4}: {1}    ", Convert.ToUInt16(ch), 
                     System.Globalization.CharUnicodeInfo.GetNumericValue(ch))
Next
開發者ID:VB.NET開發者,項目名稱:System.Globalization,代碼行數:6,代碼來源:CharUnicodeInfo.GetNumericValue

輸出:

U+D800: -1
U+DD07: -1

示例3: Main

' 導入命名空間
Imports System.Globalization

Public Class SamplesCharUnicodeInfo   

   Public Shared Sub Main()

      ' The String to get information for.
      Dim s As [String] = "a9\u0393\u00B2\u00BC\u0BEF\u0BF0\u2788"
      Console.WriteLine("String: {0}", s)

      ' Print the values for each of the characters in the string.
      Console.WriteLine("index c  Num   Dig   Dec   UnicodeCategory")
      Dim i As Integer
      For i = 0 To s.Length - 1
         Console.Write("{0,-5} {1,-3}", i, s(i))
         Console.Write(" {0,-5}", CharUnicodeInfo.GetNumericValue(s, i))
         Console.Write(" {0,-5}", CharUnicodeInfo.GetDigitValue(s, i))
         Console.Write(" {0,-5}", CharUnicodeInfo.GetDecimalDigitValue(s, i))
         Console.WriteLine("{0}", CharUnicodeInfo.GetUnicodeCategory(s, i))
      Next i

   End Sub

End Class


'This code produces the following output.  Some characters might not display at the console.
'
'String: a9\u0393\u00B2\u00BC\u0BEF\u0BF0\u2788
'index c  Num   Dig   Dec   UnicodeCategory
'0     a   -1    -1    -1   LowercaseLetter
'1     9   9     9     9    DecimalDigitNumber
'2     \u0393   -1    -1    -1   UppercaseLetter
'3     \u00B2   2     2     2    OtherNumber
'4     \u00BC   0.25  -1    -1   OtherNumber
'5     \u0BEF   9     9     9    DecimalDigitNumber
'6     \u0BF0   10    -1    -1   OtherNumber
'7     \u2788   9     9     -1   OtherNumber
開發者ID:VB.NET開發者,項目名稱:System.Globalization,代碼行數:39,代碼來源:CharUnicodeInfo.GetNumericValue

示例4:

' Define a UTF32 value for each character in the 
' Aegean numbering system.
For utf32 As Integer = &h10107 To &h10133
   Dim surrogate As String = Char.ConvertFromUtf32(utf32)
   For ctr As Integer = 0 To surrogate.Length - 1
      Console.Write("U+{0:X4} at position {1}: {2}     ", 
                    Convert.ToUInt16(surrogate(ctr)), ctr,  
                    System.Globalization.CharUnicodeInfo.GetNumericValue(surrogate, ctr))
   Next
   Console.WriteLine()
Next
開發者ID:VB.NET開發者,項目名稱:System.Globalization,代碼行數:11,代碼來源:CharUnicodeInfo.GetNumericValue

輸出:

U+D800 at position 0: 1     U+DD07 at position 1: -1
U+D800 at position 0: 2     U+DD08 at position 1: -1
U+D800 at position 0: 3     U+DD09 at position 1: -1
U+D800 at position 0: 4     U+DD0A at position 1: -1
U+D800 at position 0: 5     U+DD0B at position 1: -1
U+D800 at position 0: 6     U+DD0C at position 1: -1
U+D800 at position 0: 7     U+DD0D at position 1: -1
U+D800 at position 0: 8     U+DD0E at position 1: -1
U+D800 at position 0: 9     U+DD0F at position 1: -1
U+D800 at position 0: 10     U+DD10 at position 1: -1
U+D800 at position 0: 20     U+DD11 at position 1: -1
U+D800 at position 0: 30     U+DD12 at position 1: -1
U+D800 at position 0: 40     U+DD13 at position 1: -1
U+D800 at position 0: 50     U+DD14 at position 1: -1
U+D800 at position 0: 60     U+DD15 at position 1: -1
U+D800 at position 0: 70     U+DD16 at position 1: -1
U+D800 at position 0: 80     U+DD17 at position 1: -1
U+D800 at position 0: 90     U+DD18 at position 1: -1
U+D800 at position 0: 100     U+DD19 at position 1: -1
U+D800 at position 0: 200     U+DD1A at position 1: -1
U+D800 at position 0: 300     U+DD1B at position 1: -1
U+D800 at position 0: 400     U+DD1C at position 1: -1
U+D800 at position 0: 500     U+DD1D at position 1: -1
U+D800 at position 0: 600     U+DD1E at position 1: -1
U+D800 at position 0: 700     U+DD1F at position 1: -1
U+D800 at position 0: 800     U+DD20 at position 1: -1
U+D800 at position 0: 900     U+DD21 at position 1: -1
U+D800 at position 0: 1000     U+DD22 at position 1: -1
U+D800 at position 0: 2000     U+DD23 at position 1: -1
U+D800 at position 0: 3000     U+DD24 at position 1: -1
U+D800 at position 0: 4000     U+DD25 at position 1: -1
U+D800 at position 0: 5000     U+DD26 at position 1: -1
U+D800 at position 0: 6000     U+DD27 at position 1: -1
U+D800 at position 0: 7000     U+DD28 at position 1: -1
U+D800 at position 0: 8000     U+DD29 at position 1: -1
U+D800 at position 0: 9000     U+DD2A at position 1: -1
U+D800 at position 0: 10000     U+DD2B at position 1: -1
U+D800 at position 0: 20000     U+DD2C at position 1: -1
U+D800 at position 0: 30000     U+DD2D at position 1: -1
U+D800 at position 0: 40000     U+DD2E at position 1: -1
U+D800 at position 0: 50000     U+DD2F at position 1: -1
U+D800 at position 0: 60000     U+DD30 at position 1: -1
U+D800 at position 0: 70000     U+DD31 at position 1: -1
U+D800 at position 0: 80000     U+DD32 at position 1: -1
U+D800 at position 0: 90000     U+DD33 at position 1: -1


注:本文中的System.Globalization.CharUnicodeInfo.GetNumericValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。