VB.Net/Language Basics/Char
Содержание
Char IsDigit
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("is digit: " & Char.IsDigit("aaa") )
End Sub " Main
End Class
Char IsLetter
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("is letter: " & Char.IsLetter("aaa") )
End Sub " Main
End Class
Char IsLetterOrDigit
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("is letter or digit: " & Char.IsLetterOrDigit("aaa") )
End Sub " Main
End Class
Char IsLower
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("is lower case: " & Char.IsLower("aaa") )
End Sub " Main
End Class
Char IsPunctuation
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("is punctuation: " & Char.IsPunctuation("aaa") )
End Sub " Main
End Class
Char IsSymbol
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("is symbol: " & Char.IsSymbol("aaa"))
End Sub " Main
End Class
Char IsUpper
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("is upper case: " & Char.IsUpper("aaa") )
End Sub " Main
End Class
Char ToLower
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("to lower case: " & Char.ToLower("aaa") )
End Sub " Main
End Class
Char ToUpper
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("to upper case: " & Char.ToUpper("aaa") )
End Sub " Main
End Class
Create a Console Line by Repeating a Char
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine(New String("-"c, 100) )
End Sub
End Class
Display contents of charArray
Imports System
Public Class MainClass
Shared Sub Main()
Dim string1 As String = "hello"
Dim string2 As String = "GOOD BYE "
Dim string3 As String = " spaces "
Dim i As Integer
Dim charArray() As Char = string1.ToCharArray()
Console.WriteLine("string1 = " & string1 & vbCrLf & "string2 = " & _
string2 & vbCrLf & "string3 = " & string3)
For i = 0 To charArray.Length - 1
Console.WriteLine(charArray(i))
Next
End Sub " Main
End Class
Four ways to declare Characters
Public Class MainClass
Public Shared Sub Main()
"Character Declarations
Dim chrLtr_a As Char = "a"c
Dim chrAsc_a As Char = Chr(97)
Dim chrAsc_b As Char = ChrW(98)
Dim bytLtrA As Byte = Asc("a")
Console.WriteLine(chrLtr_a)
Console.WriteLine(chrAsc_a)
Console.WriteLine(chrAsc_b)
Console.WriteLine(bytLtrA)
End Sub
End Class