CSV ファイルについて
CSV 形式の定義
たまたま CSV 形式を処理するためのプログラムを作ろうとして,
ふと「正式な定義があるのかな?」と思い,少し調べてみました.
以下の内容は,
http://www.wotsit.org/search.asp?s=database
に置いてあった
``Comma Separated Value Files [Robert J. Lynch]''に基づくものです.
| 12345,It's a test,(^^)--123,aman@foo.bar |
各レコードの内容は次の通りである:
| 12345 |
| It's a test |
| (^^)--123 |
| aman@foo.bar |
|
"""Aman, Hirohisa""",Department of Computer
Science,"Faculty of Engineering,
[改行] Ehime University", 790-8577 Japan |
| "Aman, Hirohisa" | ※ 2 重のダブルクォーテーションとカンマがデータに含まれていた |
| Department of Computer Science | ※ダブルクォーテーションで囲む必要なし |
|
Faculty of Engineering, Ehime University |
※途中に改行が入っているが,これで 1 つのデータとなる |
| 790-8577 Japan | ※ダブルクォーテーションで囲む必要なし |
| "","this ",""," is ","","a test." |
| ,this ,, is ,,a test. |