nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ffa21d8
)
stdlib/strings: Fixed behaviour for substring_from, returns an empty string instead...
author
Lucas Bajolet
<r4pass@hotmail.com>
Fri, 7 Mar 2014 20:02:00 +0000
(15:02 -0500)
committer
Lucas Bajolet
<r4pass@hotmail.com>
Tue, 25 Mar 2014 19:30:10 +0000
(15:30 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/standard/string.nit
patch
|
blob
|
history
diff --git
a/lib/standard/string.nit
b/lib/standard/string.nit
index
d416000
..
cbd6c09
100644
(file)
--- a/
lib/standard/string.nit
+++ b/
lib/standard/string.nit
@@
-169,7
+169,8
@@
abstract class Text
# As with substring, a `from` index < 0 will be replaced by 0
fun substring_from(from: Int): SELFTYPE
do
- assert from < length
+ if from > self.length then return empty
+ if from < 0 then from = 0
return substring(from, length - from)
end