CSV : Java Glossary

CSV
CSV (Comma-Separated Value). A file of ASCII (American Standard Code for Information Interchange) fields separated by commas. Microsoft Word, Microsoft Excel, and SQL (Standard Query Language) can often import some variant on this format.
apple,"wild cherry",peach
pear,plum,"apricot"
mango,payaya,guava
"orange, Valencia",  lemon, lime
"""extra virgin"" olive", palm, date
Usually fields containing embedded spaces or commas are contained in " marks, but there are other conventions. Quotes (") inside quoted fields are doubled. Europeans often use ; and Perl aficionados use tab to separate fields instead of commas. Sybase SQL import uses ' instead of ".

I wrote CSVReader and CSVWriter which are available with complete Java source. They are full featured and configurable. As well as the read/write classes there are 20 utilities to let you do such thisgs as sort, align, pack, etc. with the library or with the sample utilities. I find these utilities useful for massaging data into tidied form, e.g. by screenscaping, without having to write any Java code.

For simple key=value you might use the built-in Properties mechanism instead. Unfortunately, it has a complex system of encoding awkward characters incompatible with CSV.

Advantages

Disdvantages


CMP homejump to top

available on the web at:

http://mindprod.com/jgloss/csv.html
  

optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\csv.html
logo
Please email your , letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email. If you want your message, your name or email kept confidential, not considered for public posting, please explicitly specify that. Unless you state otherwise, I will treat your message as a letter to the editor that I may or may not publish in the feedback section. After that, it will be too late to retract it. If you disagree with something I said, especially when sending an ad-hominem attack, a rant composed mainly of obscenities or a death threat, please quote the offending passage and cite the web page where you found it, tell me why you think it is wrong, and, if possible, provide some supporting evidence. I can’t very well fix erroneous or ambiguous text if I can’t find it.
Blog
IP:[65.110.21.43]
Your face IP:[107.22.127.92]
You are visitor number 70,729.