Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LRIM/RTRIM/TRIM built in functions
#1
It would be handy to have a 

LTRIM
RTRIM
TRIM

functions built in to ZXB

I know you could right one but I wonder if there is a faster way to be compiled?

thanks
Reply
#2
(08-01-2021, 10:00 AM)RandomiserUsr Wrote: It would be handy to have a 

LTRIM
RTRIM
TRIM

functions built in to ZXB

I know you could right one but I wonder if there is a faster way to be compiled?

thanks

Cool Good idea. I will include them in the next release.
Indeed there is a duplicated str library, and one of them will be removed.
I'll keep you updated with this.
Reply
#3
(08-01-2021, 10:00 AM)RandomiserUsr Wrote: It would be handy to have a 

LTRIM
RTRIM
TRIM

functions built in to ZXB

I know you could right one but I wonder if there is a faster way to be compiled?

thanks

Ok, I've implemented ltrim(s, subs), rtrim(s, subs) and trim(s, sub) which trim the string subs in the respective side of s.
They're in #include <string.bas> in this new version:

http://www.boriel.com/files/zxb/zxbasic-...ta1.tar.gz
http://www.boriel.com/files/zxb/zxbasic-...-beta1.zip
http://www.boriel.com/files/zxb/zxbasic-...-win32.zip
http://www.boriel.com/files/zxb/zxbasic-...x64.tar.gz
http://www.boriel.com/files/zxb/zxbasic-...cos.tar.gz

Please, try it and tell me Cool 

An example:
Code:
#include <string.bas>

print "'"; ltrim("", "a"); "'"
print "'"; ltrim("hello world", ""); "'"
print "'"; ltrim("hello world", "he"); "'"
print "'"; ltrim("hehello world", "he"); "'"
print "'"; ltrim("hehehe", "he"); "'"
Reply
#4
Thanks for doing this :-) nice one
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)