Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/08/11 11:01:33 (13 years ago)
Author:
gkronber
Message:

#1671 implemented quick fix for CSV importer and improved the import data dialog.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/TableFileParser.cs

    r6776 r6963  
    156156        } else if (OccurrencesOf(charCounts, ',') > 10) {
    157157          // no points and many commas
    158           int countCommaNonDigitPairs = 0;
    159           for (int i = 0; i < charsRead - 1; i++) {
    160             if (buffer[i] == ',' && !Char.IsDigit(buffer[i + 1])) {
    161               countCommaNonDigitPairs++;
     158          // count the number of tokens (chains of only digits and commas) that contain multiple comma characters
     159          int tokensWithMultipleCommas = 0;
     160          for (int i = 0; i < charsRead; i++) {
     161            int nCommas = 0;
     162            while (i < charsRead && (buffer[i] == ',' || Char.IsDigit(buffer[i]))) {
     163              if (buffer[i] == ',') nCommas++;
     164              i++;
    162165            }
    163           }
    164           if (countCommaNonDigitPairs > 10) {
     166            if (nCommas > 2) tokensWithMultipleCommas++;
     167          }
     168          if (tokensWithMultipleCommas > 1) {
    165169            // English format (only integer values) with ',' as separator
    166170            numberFormat = NumberFormatInfo.InvariantInfo;
Note: See TracChangeset for help on using the changeset viewer.