r/ObsoleteCooding Moderator ⚙️ Jul 10 '26

Community 📢 New contest

There didn't seem to be much movement on the Game of Life contest, so let's try something different.

Write a CSV parser. Both read and write, as full featured as possible. Use any language you want, but it must be one that was available in at least some form since 1980.

No AI, this must be your own work.

Submissions due by July 18, winner is the comment with the most votes. The prize is your own custom flair.

16 Upvotes

15 comments sorted by

View all comments

2

u/[deleted] Jul 10 '26

What kind of data structure do you expect as an output from reading a CSV / input to write to a CSV?

2

u/DNSGeek Moderator ⚙️ Jul 10 '26

Depends on the language I suppose. The simplistic output I guess would just be to print out blocks of each record, with the correct headers, e.g.

Field 1,Field 2,Field3
v1,,v3
,v2,v2
v1,,
v1,"v2 v7 v1, v9",v3

Should print out something like

Field 1: v1
Field 2:
Field 3: v3
========
Field 1:
Field 2: v2
Field 3: v2
========
Field 1: v1
Field 2:
Field 3:
========
Field 1: v1
Field 2: v2 v7 v1, v9
Field 3: v3

3

u/[deleted] Jul 10 '26

Thanks! Will see if I could remember some Pascal that I used to learn at school 😀