9.7. Characters🔗

🔗structure
Char : Type

The Char Type represents an unicode scalar value. See http://www.unicode.org/glossary/#unicode_scalar_value).

Constructor

Char.mk (val : UInt32) (valid : val.isValidChar) : Char

Fields

val:UInt32

The underlying unicode scalar value as a UInt32.

valid:self.val.isValidChar

The value must be a legal codepoint.

9.7.1. Syntax🔗

9.7.2. Logical Model🔗

9.7.3. Run-Time Representation🔗

In monomorphic contexts, characters are represented as 32-bit immediate values. In other words, a field of a constructor or structure of type Char does not require indirection to access. In polymorphic contexts, characters are boxed.

9.7.4. API Reference🔗

9.7.4.1. Character Classes🔗

🔗def
Char.isAlpha (c : Char) : Bool

Is the character in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz?

🔗def
Char.isAlphanum (c : Char) : Bool

Is the character in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789?

🔗def
Char.isDigit (c : Char) : Bool

Is the character in 0123456789?

🔗def
Char.isLower (c : Char) : Bool

Is the character in abcdefghijklmnopqrstuvwxyz?

🔗def
Char.isUpper (c : Char) : Bool

Is the character in ABCDEFGHIJKLMNOPQRSTUVWXYZ?

🔗def
Char.isWhitespace (c : Char) : Bool

Is the character a space (U+0020) a tab (U+0009), a carriage return (U+000D) or a newline (U+000A)?