nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e6dd04f
)
lib/string: chomp do not try to chomp empty strings
author
Alexis Laferrière
<alexis.laf@xymus.net>
Thu, 11 Dec 2014 20:34:44 +0000
(15:34 -0500)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Fri, 12 Dec 2014 19:21:26 +0000
(14:21 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/standard/string.nit
patch
|
blob
|
history
diff --git
a/lib/standard/string.nit
b/lib/standard/string.nit
index
604386f
..
def85f4
100644
(file)
--- a/
lib/standard/string.nit
+++ b/
lib/standard/string.nit
@@
-394,7
+394,7
@@
abstract class Text
# This method is mainly used to remove the LINE_FEED character from lines of text.
fun chomp: SELFTYPE
do
- if self.chars.last != '\n' then return self
+ if self.is_empty or self.chars.last != '\n' then return self
return substring(0, length-1)
end