The separator is a CSV-dialect issue and indeed can be changed. However, it is usually coupled to string enclosure.
If a valid string field can have separator characters, then you need another non-occurring marker for string boundaries. For example:
contains number
1
, separator
,
, and string
Hello, Dolly
. The double quotes are not part of the string; they merely protect the comma of the string.
Additional dialect choice is to treat consecutive separators as one, rather than having empty fields. Common, when separator is whitespace:
Your problem, however is very evident with this table::
sep==,
input==
hello
world
foobar |
One column, no separators. The loop ends, when there is no remaining separators. That is why you miss the last column.
You
could add the last word after the loop.