Page 1 of 1

String functions

Posted: Mon Nov 18, 2013 10:26 pm
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

Re: String functions

Posted: Tue Nov 19, 2013 8:46 am
by Mr. Kibernetik
To your information, you can always redefine existing array with better size.

Re: String functions

Posted: Tue Nov 19, 2013 6:16 pm
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.

Re: String functions

Posted: Tue Nov 19, 2013 6:30 pm
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.

Re: String functions

Posted: Thu Nov 21, 2013 12:20 pm
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.

Re: String functions

Posted: Thu Nov 21, 2013 12:21 pm
by Mr. Kibernetik
Yes, coding style is really neat!

Re: String functions

Posted: Fri Nov 22, 2013 2:41 pm
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

Re: String functions

Posted: Fri Nov 22, 2013 9:58 pm
by Dutchman
That remembers me to a period thirty years ago :D
Assembler was fun, but time-consuming :mrgreen: