lib/standard/string: Proper handling of trivial cases in substring_from.
authorLucas Bajolet <r4pass@hotmail.com>
Fri, 29 Aug 2014 19:45:34 +0000 (15:45 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Tue, 2 Sep 2014 20:16:29 +0000 (16:16 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

lib/standard/string.nit

index 821672e..22c32e8 100644 (file)
@@ -178,7 +178,7 @@ abstract class Text
        # As with substring, a `from` index < 0 will be replaced by 0
        fun substring_from(from: Int): SELFTYPE
        do
-               if from > self.length then return empty
+               if from >= self.length then return empty
                if from < 0 then from = 0
                return substring(from, length - from)
        end