Carpet

Carpet

2M Downloads

[Scarpet bug] `slice()` misses last character

altrisi opened this issue ยท 1 comments

commented

(tested in latest commit)

When you run slice(str,index), the result will be missing the last character. Using length(str) as end position makes it return the empty string.

slice('helloworld', 2) -> 'lloworl'
str = 'helloworld'; slice(str, 2) -> 'lloworld'
str = 'helloworld'; slice(str, 2, length(str)) -> ''
str = 'helloworld'; slice(str, 2, length(str) - 1) -> 'lloworl'

It was introduced in 7ad6de6 (worked correctly after locally reverting that commit).

commented

oups