@[inline, reducible]
Determines if the given integer is a valid Unicode scalar value.
Note that values in [0xd800, 0xdfff]
are reserved for UTF-16 surrogate pairs.
Instances For
Equations
- Char.instDecidableLtCharInstLTChar a b = UInt32.decLt a.val b.val
Equations
- Char.instDecidableLeCharInstLEChar a b = UInt32.decLe a.val b.val
theorem
Char.isValidChar_of_isValidChar_Nat
(n : Nat)
(h : Char.isValidCharNat n)
:
isValidChar (UInt32.ofNat' n ⋯)
@[inline]
Underlying unicode code point as a Nat
.
Equations
- Char.toNat c = UInt32.toNat c.val
Instances For
Equations
- Char.instInhabitedChar = { default := 'A' }
Is the character in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
?
Equations
- Char.isAlpha c = (Char.isUpper c || Char.isLower c)
Instances For
Is the character in ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
?
Equations
- Char.isAlphanum c = (Char.isAlpha c || Char.isDigit c)
Instances For
Convert an upper case character to its lower case character.
Only works on basic latin letters.
Equations
- Char.toLower c = let n := Char.toNat c; if n ≥ 65 ∧ n ≤ 90 then Char.ofNat (n + 32) else c
Instances For
Convert a lower case character to its upper case character.
Only works on basic latin letters.
Equations
- Char.toUpper c = let n := Char.toNat c; if n ≥ 97 ∧ n ≤ 122 then Char.ofNat (n - 32) else c