In this article we will learn how to use char
functions in VB.NET.
Char Functions
These are the following Char functions.
Char.ToUpper() Function
The ToUpper function is used to convert
lowercase character to uppercase.
Syntax
char.ToUpper ("s")
This function returns a copy of the character
in uppercase.
Char.IsDigit()
The IsDigit method Indicates whether the
specified Unicode character is categorized as a decimal digit.
Syntax
Char.IsDigit (Char1)
This function returns true if str1 is a decimal
digit, otherwise, false.
Char.Equals() Function
The Equals method is used to check whether this
instance is equal to a specified object.
For example
The below example defines the char Functions.
Module Module1
Sub Main()
Dim str As Char
str = Char.ToUpper("a")
Console.WriteLine("This
defines the Toupper function: " & str)
Dim Char1 As Char
Char1 = "8"
If Char.IsDigit(Char1)
Then
Console.WriteLine("The
character is a digit.")
Else
Console.WriteLine("The
character is a letter or symbol.")
End If
Dim chA As Char
chA = "A"c
Dim chB As Char
chB = "B"c
Console.WriteLine(chA.Equals("A"c))
Console.WriteLine("b"c.Equals(chB))
End Sub
End Module
OUTPUT
Figure 1.