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