redef fun to_i32 is intern
redef fun to_u32 is intern
+ # Returns `self` as a Char according to its ASCII value.
+ fun ascii: Char `{ return (uint32_t)self; `}
+
redef fun distance(i) do return (self - i).to_i
redef fun <=>(other)
redef fun *(i) is intern
redef fun /(i) is intern
+ # Returns `self` as a Char according to its ASCII value.
+ fun ascii: Char `{ return (uint32_t)self; `}
+
# Modulo of `self` with `i`.
#
# Returns the remainder of division of `self` by `i`.
redef fun zero do return 0.to_u16
redef fun value_of(val) do return val.to_u16
+ # Returns `self` as a Char according to its ASCII value.
+ fun ascii: Char `{ return (uint32_t)self; `}
+
# `i` bits shift to the left
#
# assert 5u16 << 1 == 10u16
redef fun *(i) is intern
redef fun /(i) is intern
+ # Returns `self` as a Char according to its ASCII value.
+ fun ascii: Char `{ return (uint32_t)self; `}
+
# Modulo of `self` with `i`.
#
# Returns the remainder of division of `self` by `i`.
redef fun *(i) is intern
redef fun /(i) is intern
+ # Returns `self` as a Char according to its ASCII value.
+ fun ascii: Char `{ return (uint32_t)self; `}
+
# Modulo of `self` with `i`.
#
# Returns the remainder of division of `self` by `i`.
# assert not "0x_".is_int
# assert not "0xGE".is_int
# assert not "".is_int
+ # assert not "Not an Int".is_int
+ # assert not "-".is_int
fun is_int: Bool do
if bytelen == 0 then return false
var s = remove_all('_')
var pos = 0
- while s[pos] == '-' do
+ var len = s.length
+ while pos < len and s[pos] == '-' do
pos += 1
end
s = s.substring_from(pos)
if hd == "0x" or hd == "0X" then return rets.is_hex
if hd == "0b" or hd == "0B" then return rets.is_bin
if hd == "0o" or hd == "0O" then return rets.is_oct
- return hd.is_dec
+ return rets.is_dec
end
redef fun to_i