nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
stdlib/strings: Fixed behaviour for substring_from, returns an empty string instead...
[nit.git]
/
lib
/
standard
/
string.nit
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