PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Query about "StrToList" behaviour

Good Afternoon All,

I am using the following code:

Code:

func GetCSV(aString$,index$)
List(lst$);
StrTolist(aString$,",",lst$);
index$--;
if ((index$ >= 0) & (index$ < count(lst$)))
goto (lst$,index$);
return (lst$);
else
return("");
end;
end;


The intent is to return an argument from a "comma separated variable list"

For the string "arg1,arg2,arg3,arg4,arg5" the call GetCSV(theString$,3) would return "arg3".

It works as expected except when there is a null argument eg: for the string "arg1,arg2,,arg4,arg5" the same call above will return "arg4", not the empty string (""). In this case a "count" of the list members (examined internally within the function) shows only 4 members in the list.

Is this result in accordance with the intent of the StrToList function or is there a bug.
Thanks for finding this bug, it will be fixed in the next version.

Regards,
Kornalius