# assert 0x220B.code_point == '∋'
fun code_point: Char is intern `{ return (uint32_t)self; `}
- # Returns the character equivalent of `self`
- #
- # REQUIRE: `self <= 127`
- fun ascii: Char do return code_point
-
# Number of digits of an integer in base `b` (plus one if negative)
#
# assert 123.digit_count(10) == 3
# Return the corresponding digit character
# If 0 <= `self` <= 9, return the corresponding character.
+ #
# assert 5.to_c == '5'
+ #
# If 10 <= `self` <= 36, return the corresponding letter [a..z].
+ #
# assert 15.to_c == 'f'
fun to_c: Char
do
end
end
- # The ascii value of `self`
- #
- # assert 'a'.ascii == 97
- # assert '\n'.ascii == 10
- #
- # REQUIRE: `is_ascii`
- fun ascii: Int do return code_point
-
# The unicode code point value of `self`
#
# assert 'A'.code_point == 65