var
c : Char;
s : String =
'[123, 2345, ''test'', ''str1, str2'', -1234, ''str3 ''is'' str4'']';
Chunks : Integer = 1;
Quotes : Boolean = true;
begin Writeln(s);
for c in s do case c of
'''': Quotes := not Quotes;
',': if Quotes then inc(Chunks)
end;
Writeln('Chunks = ', Chunks); Readln
end.
dmFyCiAgYyA6IENoYXI7CiAgcyA6IFN0cmluZyA9IAogICdbMTIzLCAyMzQ1LCAnJ3Rlc3QnJywgJydzdHIxLCBzdHIyJycsIC0xMjM0LCAnJ3N0cjMgJydpcycnIHN0cjQnJ10nOwogIENodW5rcyA6IEludGVnZXIgPSAxOwogIFF1b3RlcyA6IEJvb2xlYW4gPSB0cnVlOwoKYmVnaW4gV3JpdGVsbihzKTsgCiAgZm9yIGMgaW4gcyBkbyBjYXNlIGMgb2YKICAgICcnJyc6IFF1b3RlcyA6PSBub3QgUXVvdGVzOwogICAgICcsJzogaWYgUXVvdGVzIHRoZW4gaW5jKENodW5rcykgCiAgZW5kOwogIFdyaXRlbG4oJ0NodW5rcyA9ICcsIENodW5rcyk7IFJlYWRsbgplbmQu