Data Type - char
This deals with individual characters
Represents a 16 bit unicode character
With Option Strict On you must convert a String type such as "A" into a Character type by using CChar()
Smallest value is \u000
Largest value is \uFFFF
The Char data type can hold a single Unicode character
The Char class represents a single character.
This class exposes a number of useful shared methods that let you test a single character according to several criteria
All of these methods are overloaded and take either a single Char or a String plus an index in the string
mystring = new string(System.Convert.ToChar(90),1);
The Char type represents a Unicode character
If you want to assign a single characeter literal to a Char variable you must use the literal character C to force the string to a Char data type
myChar = "X"C;
myChar = 'A';
It is possible to represent an escape character by prefixing with the backslash character.
myChar = '\n';
myChar = '\u0031';
myChar = '\x0031';
Any Char variables are initialised to ""
When assigning a literal character to a Char variable you should yse a trailing "c" to make it explicit that the character must be converted to a Char before assignment.
myChar = "A"c;
The following line will cause a complilation error
myChar = "ABC"c;
Char Structure Methods
© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext