EDIT:nco2k wrote:>> SplitC() does not catch a trailing null?
yes, thats by design. why would you want to do that anyway? i mean you can change it if you really want to, i just dont see the point.
It is the same issue I mentioned prior: "1,2,3,," Splits to [1][2][3][][]. 5 members with 2 nulls.
>> My Split() uses a CountString() at beginning.
not a good idea. browsing through the string twice, will give you terrible performance. this might be ok for such a small string, but now try it with a large string. the bigger the string is, the more your procedure will fall behind. and dont use a string parameter. use a pointer instead: http://www.purebasic.fr/english/viewtop ... 98#p513698
Thanks, I have refactored some functions based on your suggestion. I will post delta times later.
Updated my prior Split() code with nco2k's suggestions and ran speed comparisons for short and long strings vs several Split() approaches.
EDIT2:
Modified nco2k's SplitC() to retain final trailing null's. Shaved some more time off Split(). All the Splitxx() routines now return same number of strings for a given input.
EDIT3:
nco2k simplified SplitC() further, shaving off more ms.
EDIT4:
Modified Split(),SplitC() to avoid 'Pointer is null' if pointing to an array element = Empty$.