Fixed slice() returning empty string when referring to last character (#751)

* Fixed slice() returning empty string when referring to last character
This commit is contained in:
replaceitem authored and GitHub committed 2021-03-01 22:10:49 -04:00
1 parent aa372f5480
commit ca4db433c1
3 files changed
+4 -4

No files matched your search

@@ -341,7 +341,7 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
int from = normalizeIndex(fromDesc, size);
if (toDesc == null)
return new ListValue((Collection<? extends Value>) getItems().subList(from, size));
int to = normalizeIndex(toDesc, size);
int to = normalizeIndex(toDesc, size+1);
if (from > to)
return ListValue.of();
return new ListValue((Collection<? extends Value>) getItems().subList(from, to));