From: Alexandre Terrasa Date: Wed, 5 Mar 2014 16:23:39 +0000 (-0500) Subject: lib: cleaned trailing spaces in string X-Git-Tag: v0.6.5~53^2~1 X-Git-Url: http://nitlanguage.org?ds=sidebyside lib: cleaned trailing spaces in string Signed-off-by: Alexandre Terrasa --- diff --git a/lib/standard/string.nit b/lib/standard/string.nit index d4d03f7..f080e2a 100644 --- a/lib/standard/string.nit +++ b/lib/standard/string.nit @@ -5,7 +5,7 @@ # # 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 @@ -988,13 +988,13 @@ redef class Bool # 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 - end + end end redef class Int @@ -1015,7 +1015,7 @@ redef class Int 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 @@ -1051,6 +1051,7 @@ redef class Float # 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 @@ -1159,14 +1160,14 @@ redef class Collection[E] 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) - + # Concat other items i.next while i.is_ok do @@ -1207,7 +1208,7 @@ redef class Map[K,V] fun join(sep: String, couple_sep: String): String do if is_empty then return "" - + var s = new Buffer # Result # Concat first item