SPLITSTR() not working as expected

Previous topic - Next topic

Moru

Splitstr() seems to ignore empty fields when splitting a string. See below example

Code (glbasic) Select
LOCAL array$[], n
SPLITSTR(";a;b;     ;d;;f;", array$[], ";")
FOREACH a$ IN array$[]
STDOUT n + ": " + a$ + "\n"
INC n
NEXT
KEYWAIT
END



Code (glbasic) Select

Output:
0: a
1: b
2: d
3: f

Expected output:
0:
1: a
2: b
3: <lots of spaces>
4: d
5: <zero-length string>
6: f
7: <zero-length string>


When reading listings it would be preffered if the splitting doesn't skip empty fields since you have no idea if your fields are the correct ones then.

Kitty Hello

Oh dear, there is a huge bug with spaces in strings.
To all: UPDATE (in about 10 minutes)

This bug came with the first version of the precompiler. All multiple spaces in strings are swallowed!