How to programmatically guess whether a CSV file is comma or semicolon delimited
问题 In most cases, CSV files are text files with records delimited by commas. However, sometimes these files will come semicolon delimited. (Excel will use semicolon delimiters when saving CSVs if the regional settings has the decimal separator set as the comma -- this is common in Europe. Ref: http://en.wikipedia.org/wiki/Comma-separated_values#Application_support) My question is, what is the best way to have a program guess whether to have it comma or semicolon separated? e.g. a line like 1,1;1