Char
Data Type
Holds unsigned 32-bit (4-byte) Unicode character code points in the range 0–4,294,967,295.
Instructions
Char
is short for “character”.
- Default value
- When you declare a variable of type
Char
and do not initialize it, its default value is the character with a code point of zero (0). - Negation
Char
is an unsigned type and thus cannot hold a negative value.- Automatic conversions
Char
widens toString
without risk of overflow.- Type characters
Char
has no type character.
Unicode characters
TODO
Character literal
You can give a code point for most Unicode characters directly in your code with a character literal.
You write a character literal with the character between backticks (`
).
Some examples follow.
Dim letter As Char = `A`
Dim backtick As Char = ```
Shared methods and properties
Char.Default As Char
- Returns
%NUL
. Char.Lower(c As Char, Optional #fmt As Format) As Char
- Returns a lower-case letter if given an upper-case letter, or the given character if it is not a letter.
Char.Size As Int32
- Returns the number of available bytes. This is always 4.
Char.Upper(c As Char, Optional #fmt As Format) As Char
- Returns an upper-case letter if given a lower-case letter, or the given character if it is not a letter.
The methods that follow have two overloads each:
(1) a necessary character (chr
),
or (2) a necessary string (str
) and a necessary position (pos
) in it.
The position starts at zero.
Char.IsControl(chr As Char) As Boolean Char.IsControl(str As String, pos As Int32) As Boolean
- Returns true if given a control character, and false if given a different character.
Char.IsDigit(chr As Char) As Boolean Char.IsDigit(str As String, pos As Int32) As Boolean
- Returns true if given a number between 0 and 9, and false if given a different character.
Char.IsLetter(chr As Char) As Boolean Char.IsLetter(str As String, pos As Int32) As Boolean
- Returns true if given a letter, and false if given a different character.
Char.IsLower(chr As Char) As Boolean Char.IsLower(str As String, pos As Int32) As Boolean
- Returns true if given a lower-case letter, and false if given a different character.
Char.IsNumber(chr As Char) As Boolean Char.IsNumber(str As String, pos As Int32) As Boolean
- Returns true if given a number or related character, and false if given a different character.
Char.IsPunctuation(chr As Char) As Boolean Char.IsPunctuation(str As String, pos As Int32) As Boolean
- Returns true if given a punctuation character, and false if given a different character.
Char.IsSeparator(chr As Char) As Boolean Char.IsSeparator(str As String, pos As Int32) As Boolean
- Returns true if given a separator character, and false if given a different character.
Char.IsSymbol(chr As Char) As Boolean Char.IsSymbol(str As String, pos As Int32) As Boolean
- Returns true if given a symbol character, and false if given a different character.
Char.IsUpper(chr As Char) As Boolean Char.IsUpper(str As String, pos As Int32) As Boolean
- Returns true if given an upper-case letter, and false if given a different character.
Char.IsWhitespace(chr As Char) As Boolean Char.IsWhitespace(str As String, pos As Int32) As Boolean
- Returns true if given a whitespace character, and false if given a different character.
Char.UnicodeBlock(chr As Char) As UnicodeBlocks Char.UnicodeBlock(str As String, pos As Int32) As UnicodeBlocks
- Returns an enumeration value of type
UnicodeBlocks
that is related to the Unicode block of the given character.