char
struct charAvailable without an import.
A 32-bit Unicode code-point value, defaulting to U+0000. Text encoding replaces surrogate or out-of-range values with U+FFFD. Classification and simple one-code-point casing use the bundled Unicode tables; use string casing for expansions such as sharp-s to SS.
api fn Main() : int32 {
char accented = 'é';
return accented.IsLetter() && accented.ByteWidth() == 2 && accented.ToUpper() == 'É' ? 1 : 0;
}
Members
constructorconstructor
public constructor ()Creates U+0000.
GetHashCodemethod
public fn GetHashCode() : uint32Hashes the stored code-point value.
ToStringmethod
public fn ToString() : stringEncodes this value as UTF-8, replacing invalid scalar values with U+FFFD.
ToStringBuffermethod
public fn ToStringBuffer(StringBuilder builder) : int32Appends the UTF-8 encoding and returns the number of bytes appended. Invalid scalar values encode as U+FFFD.
Equalsmethod
public fn Equals(char other) : boolTests exact code-point equality.
CompareTomethod
public fn CompareTo(char other) : int32Returns -1, 0, or 1 according to numeric code-point order, not locale collation.
ByteWidthmethod
public fn ByteWidth() : int32Returns the UTF-8 encoded byte width, from 1 to 4. Invalid scalars return 3 for their U+FFFD replacement.
Categorymethod
public fn Category() : UnicodeCategoryReturns the Unicode General_Category.
IsLettermethod
public fn IsLetter() : boolTests for any of the five Unicode letter categories.
IsDigitmethod
public fn IsDigit() : boolTests for Unicode decimal digits, including non-ASCII scripts.
IsWhitespacemethod
public fn IsWhitespace() : boolTests the Unicode White_Space binary property.
IsUppermethod
public fn IsUpper() : boolTests the UppercaseLetter category.
IsLowermethod
public fn IsLower() : boolTests the LowercaseLetter category.
IsPunctuationmethod
public fn IsPunctuation() : boolTests for any Unicode punctuation category.
IsLetterOrDigitmethod
public fn IsLetterOrDigit() : boolTests for a Unicode letter or decimal digit.
IsNumbermethod
public fn IsNumber() : boolTests for decimal digits, letter numbers, or other Unicode numbers.
ToUppermethod
public fn ToUpper() : charApplies the simple one-code-point uppercase mapping. Does not expand to multiple characters.
ToLowermethod
public fn ToLower() : charApplies the simple one-code-point lowercase mapping. Does not apply contextual or locale-specific string casing.
ToUpperCharCountmethod
public fn ToUpperCharCount() : int32Returns one, since character uppercase mapping never expands.
ToLowerCharCountmethod
public fn ToLowerCharCount() : int32Returns one, since character lowercase mapping never expands.
ScriptOfmethod
public fn ScriptOf() : UnicodeScriptReturns the Unicode Script property, including Common and Inherited where applicable.
HasBinaryPropertymethod
public fn HasBinaryProperty(UnicodeBinaryProperty prop) : boolTests membership in the supplied Unicode binary property.