Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:38 02 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MMBasic for Windows 5.07.03B24 notes

Author Message
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 288
Posted: 05:26am 24 Apr 2025
Copy link to clipboard 
Print this post

Sorry boys, I feel ugly posting this as new thread.
Found in MMB4W 5.07.03B24. Not a bug, still developers might want to mark this as "to fix someday" for better code compat.


MID$(string$,patern$,1)=""


would throw:
>Error in line xx : Supplied string too short

But would accept to do the same

MID$(string$,patern$,1)=CHR$(0)

My MMBasic 'sand box'
 
dMajo

Newbie

Joined: 18/05/2020
Location: Italy
Posts: 27
Posted: 06:11am 24 Apr 2025
Copy link to clipboard 
Print this post

In my opinion it could seems the same but it is not.
in the first case we have a zero lenght (no characters) string, while in the second example the chr$ function returns 1 character string even if of binary value 0.
ALLdataEE.com  EDU Promos
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3988
Posted: 06:29am 24 Apr 2025
Copy link to clipboard 
Print this post

Looks like a bug.

John
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 288
Posted: 06:36am 24 Apr 2025
Copy link to clipboard 
Print this post

  dMajo said  In my opinion it could seems the same but it is not.
in the first case we have a zero lenght (no characters) string, while in the second example the chr$ function returns 1 character string even if of binary value 0.


Yes.
Like I said it`s not a bug, but posted this, becouse Picomites in same situation would accept ="" and MMB4W (maybe) needs fix in some blurr future, for beter code compatibility. Thats it.
My MMBasic 'sand box'
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2137
Posted: 09:57am 24 Apr 2025
Copy link to clipboard 
Print this post

  electricat said  

MID$(string$,patern$,1)=""


would throw:
>Error in line xx : Supplied string too short

But would accept to do the same

MID$(string$,patern$,1)=CHR$(0)


in the first code example you say "substitute one character with this zero length string" Whether that makes sense or not is arguable (personally I don't have an issue with it and I can see it being useful), but it isn't allowed in MMB4W, therefore such discussion is moot.

Unless I am missing something, I would say things are "as designed".

h
Edited 2025-04-24 20:14 by CaptainBoing
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10000
Posted: 10:05am 24 Apr 2025
Copy link to clipboard 
Print this post

The PicoMite supports

S$="12345678"
mid$(s$,3,2)=""


as a perfectly valid way of removing characters from within a string. I haven't updated MMB4W with this new functionality - one day perhaps....
CMM2 is the same as PicoMite
Edited 2025-04-24 20:07 by matherp
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025