View Issue Details

IDProjectCategoryView StatusLast Update
0027644RunnerFunctionsPublic2018-06-27 12:10
ReporterStewart BishopAssigned ToClaire Hall 
PriorityLowSeverityC - GeneralReproducibility100%
Status ClosedResolutionFixed 
Product Version 
Target VersionFixed in VersionPre-2.1.3 
Summary0027644: Functions: string_delete() with a count 0 of deletes everything before starting position
Description string_delete() is very broken...

Docs say usage is string_delete(str, index, count); which is consistent with how it's always worked. But the docs also say "So, you supply the input string and the start and end position within that string to remove characters" which is totally different--supplying the start and end is not the same as supplying the start and the count.

But the really broken part is that the function works both ways-ish.

Usually, it works like string_delete(str, index, count), unless your count is zero. If you compute a length of string to copy and it's zero, then suddenly the function deletes from wherever you said backwards to zero.

Example 1:
str = "this is a string";
str = string_delete(str,6,1);

Result: this s a string

Example 2:
str = "this is a string";
str = string_delete(str,6,0);

Result: is a string

In example 1, length is used in the traditional way. When the length is zero or less, though, it is treated as a position, and the head of the string is chopped. Deleting a length of zero characters from a position should not delete anything.
Steps To Reproduce1) Run the attached project
2) Move the count up or down using left and right
3) See that at 0 count this removes everything left of the position
TagsNo tags attached.
1.4 Found In
2.x Runtime Found In2.1.0.136
2.x Runtime Verified In


Stewart Bishop

2017-08-31 16:59


test string_delete.yyz (13,936 bytes)

Mike Dailly

2017-09-01 09:29

Developer   ~0055201

Should be a start position and a count.

Claire Hall

2017-09-20 08:57

Developer   ~0055573

fixed in both c++ runner and html5


2018-01-29 10:19

Adminstrator   ~0057499

Also fixed an issue with string_delete on html5 when "count" is negative as part of the above change.