From: Lucas Bajolet Date: Fri, 29 Aug 2014 19:45:34 +0000 (-0400) Subject: lib/standard/string: Proper handling of trivial cases in substring_from. X-Git-Tag: v0.6.9~60^2~3 X-Git-Url: http://nitlanguage.org lib/standard/string: Proper handling of trivial cases in substring_from. Signed-off-by: Lucas Bajolet --- diff --git a/lib/standard/string.nit b/lib/standard/string.nit index 821672e..22c32e8 100644 --- a/lib/standard/string.nit +++ b/lib/standard/string.nit @@ -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