how to find out if csv file fields are tab delimited or comma delimited

后端 未结 15 1020
[愿得一人]
[愿得一人] 2020-12-01 09:46

how to find out if csv file fields are tab delimited or comma delimited. I need php validation for this. Can anyone plz help. Thanks in advance.

15条回答
  •  甜味超标
    2020-12-01 10:18

    Aside from the trivial answer that c sv files are always comma-separated - it's in the name, I don't think you can come up with any hard rules. Both TSV and CSV files are sufficiently loosely specified that you can come up with files that would be acceptable as either.

    A\tB,C
    1,2\t3
    

    (Assuming \t == TAB)

    How would you decide whether this is TSV or CSV?

提交回复
热议问题