• 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
     
     


  • 相关阅读:
    类和接口对比
    concurrenthasmap
    java中的三大注解
    基本数据类型,注意首字母
    常见ascii码记忆
    Java软件工程师面试题:Java运行时异常与一般异常有什么不一样?
    &和&&的共同点和区别、Java字符含义和Java创建对象的几种方式
    Java面试题中常考的容易混淆的知识点区别
    Java面试题整理:这些Java程序员面试中经常遇见的题目,必须掌握才能有好结果
    Spring Cloud 微服务架构的五脏六腑,统统晒一晒!
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3621050.html
Copyright © 2020-2023  润新知