I played a bit today with the new Evaluator array functions.
I tried to explode a string of words into an array.
Here is what I have so far.
Here is the Ad-Hoc script file.
Words 07.zip (465 Bytes)
I played a bit today with the new Evaluator array functions.
I tried to explode a string of words into an array.
Here is what I have so far.
Here is the Ad-Hoc script file.
Words 07.zip (465 Bytes)
I was about to suggest this
str = " This is a collection of words separated by spaces. ";
sep = " ";
str = Trim(str);
str = RegExS(str, sep + "+", sep);
Output(str);
arr = ArrayCreate();
tmp = "";
for (i = 0; i < len(str); i++) {
c = Mid(str, i, 1);
if (c == sep) {
Output(tmp);
ArrayPush(arr, tmp);
tmp = "";
}
else {
tmp += c;
}
}
ArrayPush(arr, tmp);
Output(arr);
But we have a problem.
So we'll need to wait a bit, or kindly ask for a Split() function.
Both, actually ![]()
In php they are called explode() and implode() . ![]()
I didn't know we could do that !
This appears to be the better way.
I'll look at your code more later today.
I have to drive a school bus of basketball players to practice with another school and will have a couple of hours.
Life just got boring ![]()
(Would have preferred split/join and left explode/implode to the PHP crowd, though)
Very funny !
Split() and Join() are fine. Or perhaps a name that more clearly differentiates them as functions of strings and arrays instead of only strings or arrays ?
Edit: I didn't see the new beta !
If anyone wants a name change, now is the time to ask.