Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
#
# This file is free software, which comes along with NIT. This software is
# distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
#
# This file is free software, which comes along with NIT. This software is
# distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. You can modify it is you want, provided this header
# is kept unaltered, and a notification of the changes is added.
# You are allowed to redistribute it and sell it, alone or is a part of
# PARTICULAR PURPOSE. You can modify it is you want, provided this header
# is kept unaltered, and a notification of the changes is added.
# You are allowed to redistribute it and sell it, alone or is a part of
# assert true.to_s == "true"
# assert false.to_s == "false"
redef fun to_s
# assert true.to_s == "true"
# assert false.to_s == "false"
redef fun to_s
- do
- if self then
- return once "true"
- else
- return once "false"
+ do
+ if self then
+ return once "true"
+ else
+ return once "false"
end
# Fill digits
var pos = digit_count(base) - 1
end
# Fill digits
var pos = digit_count(base) - 1
- while pos >= 0 and n > 0 do
+ while pos >= 0 and n > 0 do
s.chars[pos] = (n % base).to_c
n = n / base # /
pos -= 1
s.chars[pos] = (n % base).to_c
n = n / base # /
pos -= 1
# Pretty print self, print needoed decimals up to a max of 3.
redef fun to_s do
var str = to_precision( 3 )
# Pretty print self, print needoed decimals up to a max of 3.
redef fun to_s do
var str = to_precision( 3 )
+ if is_inf != 0 then return str
var len = str.length
for i in [0..len-1] do
var j = len-1-i
var len = str.length
for i in [0..len-1] do
var j = len-1-i
fun join(sep: String): String
do
if is_empty then return ""
fun join(sep: String): String
do
if is_empty then return ""
var s = new Buffer # Result
# Concat first item
var i = iterator
var e = i.item
if e != null then s.append(e.to_s)
var s = new Buffer # Result
# Concat first item
var i = iterator
var e = i.item
if e != null then s.append(e.to_s)
# Concat other items
i.next
while i.is_ok do
# Concat other items
i.next
while i.is_ok do
fun join(sep: String, couple_sep: String): String
do
if is_empty then return ""
fun join(sep: String, couple_sep: String): String
do
if is_empty then return ""
var s = new Buffer # Result
# Concat first item
var s = new Buffer # Result
# Concat first item