本文整理汇总了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