RAA - csvparser

csvparser / 0.9.0

Short description: CSV format parser/generator
Category: Library/Text
Status: stable
Created: 2003-05-08 05:56:01 GMT
Last update: 2003-05-08 05:56:00 GMT
Owner: SUZUKI Tetsuya (Projects of this owner)
Homepage: http://www.spice-of-life.net/download/csvparser/
Download: http://www.spice-of-life.net/download/csvparser/archive/csvparser-0.9.0.tar.gz
License: Ruby's
Dependency:
None
Description:

CSVParser is a library to parse and generate CSV(Comma Sepalated Value) format text data. It can do TSV(Tab Sepalated Value) format text data with tab as sepalate delimiter.

CSV format is used in many applications, however the applications have own rules. Then CSVParser refers a CSV format generated by Microsoft Excel.

Basic rules are the following:

* Each fields are sepalated by comma(delimiter can be changed).
* Fields are enclosed with double quotes. However, fields that don't include control characters can be omitted quotes. Data outside of quotes is ignored.
* End of line is "CR", "LF", or "CR+LF".
* 2 double quotes("") means itself("). Fields including it must be enclosed with double quotes.
* Fields "" only are empty.
* Spaces at start and end are included data(its can be deleted with option).

ex) ^M = CR + LF

foo,bar,baz -> ["foo","bar","baz"]
"foo","bar","baz" -> ["foo","bar","baz"]
"""foo""","bar","" -> ["¥"foo¥"","bar",""]
" foo", bar ,baz -> [" foo"," bar ","baz"]
ignore"foo","bar"ignore,"^Mbaz^M" -> ["foo","bar","¥r¥nbaz¥r¥n"]

Edit this project (for project owner)

back to RAA top