To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit e50950a4 authored by Stefan Marr's avatar Stefan Marr
Browse files

Adapt substring primitive to Smalltalk's 1-based indexing


Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent 8bb3dd33
......@@ -29,11 +29,11 @@ def _substring(ivkbl, frame, interpreter):
start = frame.pop()
rcvr = frame.pop()
s = start.get_embedded_integer()
e = end.get_embedded_integer() + 1
s = start.get_embedded_integer() - 1
e = end.get_embedded_integer()
string = rcvr.get_embedded_string()
if s < 0 or s >= len(string) or e >= len(string) or e < s:
if s < 0 or s >= len(string) or e > len(string) or e < s:
frame.push(interpreter.get_universe().new_string("Error - index out of bounds"))
else:
frame.push(interpreter.get_universe().new_string(string[s:e]))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment