本文整理匯總了VB.NET中System.String.Chars屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET String.Chars屬性的具體用法?VB.NET String.Chars怎麽用?VB.NET String.Chars使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.String
的用法示例。
在下文中一共展示了String.Chars屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1:
Console.Write("Type a string : ")
Dim myString As String = Console.ReadLine()
Dim i As Integer
For i = 0 To myString.Length - 1
If Uri.IsHexDigit(myString.Chars(i)) Then
Console.WriteLine("{0} is a hexadecimal digit.", myString.Chars(i))
Else
Console.WriteLine("{0} is not a hexadecimal digit.", myString.Chars(i))
End If
Next
' The example produces output like the following:
' Type a string : 3f5EaZ
' 3 is a hexadecimal digit.
' f is a hexadecimal digit.
' 5 is a hexadecimal digit.
' E is a hexadecimal digit.
' a is a hexadecimal digit.
' Z is not a hexadecimal digit.
示例2:
Dim str1 As String = "Test"
For ctr As Integer = 0 to str1.Length - 1
Console.Write("{0} ", str1(ctr))
Next
輸出:
T e s t