zoukankan      html  css  js  c++  java
  • CSV Format

    CSV Format

      The comma separated values format (CSV) has been used for exchanging and converting data between various spreadsheet programs for quite some time. RFC documents the format of comma separated values (CSV) files and formally registers the "text/csv" MIME type for CSV in accordance with RFC 2048.

         1. Each record is located on a separate line, delimited by a line break (CRLF). For example:

      

      以CRLF来区别每一个record

      2. The last record in the file may or may not have an ending line break. For example:

       

      最后一条记录可以不加CRLF

      3. There maybe an optional header line appearing as the first lineof the file with the same format as normal record lines.  This header will contain names corresponding to the fields in the file and should contain the same number of fields as the records in the rest of the file (the presence or absence of the header line should be indicated via the optional "header" parameter of this MIME type).  For example:
      
      可以添加head,通过optional parameter的header flag来指示
      4. Within the header and each record, there may be one or more fields, separated by commas.  Each line should contain the same number of fields throughout the file.  Spaces are considered part of a field and should not be ignored.  The last field in the record must not be followed by a comma.  For example:
      
      用逗号分隔

      5. Each field may or may not be enclosed in double quotes (however
    some programs, such as Microsoft Excel, do not use double quotes at all). If fields are not enclosed with double quotes, then double quotes may not appear inside the fields. For example:
      
      可以有也可以没有双引号
      6.  Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes.  For example:
      
      如果有CRLF, 双引号,逗号,则这些符号必须放置在双引号中。
      7.  If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote.  For example:
      
      使用双引号时,必须前置双引号以escape
    参考:http://www.rfc-editor.org/rfc/rfc4180.txt
     
     


  • 相关阅读:
    安装包安装服务,点修复出现的错误”Error 1001:指定的服务已存在“ 解决办法
    C# tostring 格式化输出 (转)
    WPF button 如何区分click和doubleclick
    二叉树算法
    关于OA流程相关数据表的设计
    没事干写写流程审批数据库的设计
    挂载system.img并提取文件
    使Checkbox禁用,不可选
    Android显示网速的另一种方法
    C语言 解压华为固件
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3621050.html
Copyright © 2011-2022 走看看