本文整理匯總了VB.NET中System.Char.IsControl方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Char.IsControl方法的具體用法?VB.NET Char.IsControl怎麽用?VB.NET Char.IsControl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Char
的用法示例。
在下文中一共展示了Char.IsControl方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: ControlChars
Module ControlChars
Public Sub Main()
Dim charsWritten As Integer = 0
For ctr As Integer = &H0 To &HFFFF
Dim ch As Char = Convert.ToChar(ctr)
If Char.IsControl(ch) Then
Console.Write("\U{0:X4} ", ctr)
charsWritten += 1
If (charsWritten Mod 6) = 0 Then
Console.WriteLine()
End If
End If
Next
End Sub
End Module
輸出:
\U0000 \U0001 \U0002 \U0003 \U0004 \U0005 \U0006 \U0007 \U0008 \U0009 \U000A \U000B \U000C \U000D \U000E \U000F \U0010 \U0011 \U0012 \U0013 \U0014 \U0015 \U0016 \U0017 \U0018 \U0019 \U001A \U001B \U001C \U001D \U001E \U001F \U007F \U0080 \U0081 \U0082 \U0083 \U0084 \U0085 \U0086 \U0087 \U0088 \U0089 \U008A \U008B \U008C \U008D \U008E \U008F \U0090 \U0091 \U0092 \U0093 \U0094 \U0095 \U0096 \U0097 \U0098 \U0099 \U009A \U009B \U009C \U009D \U009E \U009F
示例2: ControlChar
Module ControlChar
Public Sub Main()
Dim sentence As String = "This is a " & vbCrLf & "two-line sentence."
For ctr As Integer = 0 to sentence.Length - 1
If Char.IsControl(sentence, ctr) Then
Console.WriteLine("Control character \U{0} found in position {1}.", _
Convert.ToInt32(sentence.Chars(ctr)).ToString("X4"), ctr)
End If
Next
End Sub
End Module
輸出:
Control character \U000D found in position 10. Control character \U000A found in position 11.