本文整理匯總了VB.NET中System.Char.IsNumber方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Char.IsNumber方法的具體用法?VB.NET Char.IsNumber怎麽用?VB.NET Char.IsNumber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Char
的用法示例。
在下文中一共展示了Char.IsNumber方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: IsNumberSample
Module IsNumberSample
Sub Main()
Dim str As String
str = "non-numeric"
Console.WriteLine(Char.IsNumber("8"c)) ' Output: "True"
Console.WriteLine(Char.IsNumber(str, 3)) ' Output: "False"
End Sub
End Module
示例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),
Char.IsNumber(ch))
Next
輸出:
U+D800: False U+DD07: False
示例3:
Dim utf32 As Integer = &h10107 ' AEGEAN NUMBER ONE
Dim surrogate As String = Char.ConvertFromUtf32(utf32)
For ctr As Integer = 0 To surrogate.Length - 1
Console.WriteLine("U+{0:X4} at position {1}: {2}",
Convert.ToUInt16(surrogate(ctr)), ctr,
Char.IsNumber(surrogate, ctr))
Next
輸出:
U+D800 at position 0: True U+DD07 at position 1: False