PatternLanguage icon indicating copy to clipboard operation
PatternLanguage copied to clipboard

Added check for substrings that span longer than the original string

Open MartorSkull opened this issue 1 year ago • 0 comments

This change follows a discussion that we had on discord. We ended up deciding to modify the behaviour of the substr function to throw an error when the requested substring spans further away from the ending of the orignial string.

Thus changind the return value of the functions from: [pos, min(pos+count, string.length())] to: [pos, pos+count]

This makes the function treat the intial value and ending value the same.

The oposite solution would have been to make the start not throw an error and instead simply return an emptry string.

MartorSkull avatar Aug 21 '24 19:08 MartorSkull