String functions

Post Reply
wdmcdaniel
Posts: 21
Joined: Thu Nov 14, 2013 4:12 pm

String functions

Post by wdmcdaniel »

While our host is adding many of these functions to the base language, I thought I would upload a little library of string functions I've been working on. I have several others in the works including a translate and some helpful but obscure functions around word matching.

I hope these are helpful, though.

Bill
Attachments
string.txt
library of sting functions. Suitable for use via {/string.txt/}
(4.7 KiB) Downloaded 362 times

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: String functions

Post by Mr. Kibernetik »

To your information, you can always redefine existing array with better size.

wdmcdaniel
Posts: 21
Joined: Thu Nov 14, 2013 4:12 pm

Re: String functions

Post by wdmcdaniel »

Thanks,

I did not realize I could just redefine the array on the fly...good way to clear it. Can I change the sizes of each dimension in a multi-dimension array?

Is that a costly process interns of computing time?

In later basics there is a REDIM statement to do this and it usually has a PRESERVE keyword to preserve the contents of the array. But it is usually a costly process to do so.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: String functions

Post by Mr. Kibernetik »

wdmcdaniel wrote:Thanks,

I did not realize I could just redefine the array on the fly...good way to clear it. Can I change the sizes of each dimension in a multi-dimension array?

Is that a costly process interns of computing time?

In later basics there is a REDIM statement to do this and it usually has a PRESERVE keyword to preserve the contents of the array. But it is usually a costly process to do so.
You can change sizes of each dimension in a multi-dimension array with just another DIM command. But you cannot change number of dimensions when re-declaring it.
Speed of DIM command is equal whether it is first declaration of array or it is a re-declaration. Definitely it is faster to re-declare an array than clearing it with zeroes in program.

User avatar
Dutchman
Posts: 851
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Re: String functions

Post by Dutchman »

Thanks for the lib.
I have no experience with it yet, but I will certainly use it until Smart Basic has these extensions.
Actually I considered it to program it myself, but you solved my problem.
I like your coding style with comments, indentation, separation lines etc.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: String functions

Post by Mr. Kibernetik »

Yes, coding style is really neat!

wdmcdaniel
Posts: 21
Joined: Thu Nov 14, 2013 4:12 pm

Re: String functions

Post by wdmcdaniel »

Thanks for the compliments. Line by line comments are a habit from my assembler coding days. I find that if I don't comment almost line by line, then I can't recall why I wrote a line of code six months later :)

I'll bring out another version of the library shortly...adding a lot of useful functions from the REXX language.

Bill

User avatar
Dutchman
Posts: 851
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Re: String functions

Post by Dutchman »

That remembers me to a period thirty years ago :D
Assembler was fun, but time-consuming :mrgreen:

Post Reply