You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BITMAP ENABLE(320,200,4)
BORDER WHITE
CLS BLACK
DEFINE KEYBOARD ASYNC
a="ugBASIC"
MID(a,3,1)=""
PRINT "a=";a
To me, this seems as though it shouldn't do anything to string a.
However, it actually removes the B from ugBASIC.
I know that replacing the B with an empty string would conceptually remove the B, but it seems odd than an empty string would do anything at all to string a.
Not sure.
Maybe it's ok as it is.
:)
The text was updated successfully, but these errors were encountered:
Hi @poppichicken , and thank you for your kind bug report!
The behavior is correct. However, so is your doubt. So we are faced with a behavior of MID that can be different, depending on whether it is interpreted as a change (therefore: with a variation of the length of the string) or as a replacement. For this reason, I believe it is necessary to introduce a pragma (i.e. a directive) that allows you to define which of the two behaviors you want.
The pragma will be OPTION MID REPLACE if you want MID to behave as you expect, that is, with an empty string (or in any case: with a string of length less than that indicated by the parameter) it does not alter the characters that are beyond the minimum value between the length of the string and the length given as a parameter.
The pragma will be OPTION MID INSERT if, instead, you want to maintain the current behavior, therefore with an insertion "in place of" the string in question.
hi Marco.
To me, this seems as though it shouldn't do anything to string a.
However, it actually removes the B from ugBASIC.
I know that replacing the B with an empty string would conceptually remove the B, but it seems odd than an empty string would do anything at all to string a.
Not sure.
Maybe it's ok as it is.
:)
The text was updated successfully, but these errors were encountered: