15f70a1451e9791fc080647cb8d913a5a6e0aa3b kent Wed May 31 18:17:40 2017 -0700 Adding csvNeedsParsing diff --git src/lib/csv.c src/lib/csv.c index 8338c6f..c5287d1 100644 --- src/lib/csv.c +++ src/lib/csv.c @@ -126,15 +126,24 @@ ++s; // skip over trailing comma. break; } dyStringAppendC(scratch, c); lastC = c; c = *(++s); } if (isspace(lastC)) eraseTrailingSpaces(scratch->string); } // Update position to start reading next one from and return scratchpad *pos = s; return scratch->string; } + +boolean csvNeedsParsing(char *s) +/* Return TRUE if s is something that needs parsing through the csv parser. That + * is it either starts with a quote or has a comma */ +{ +if (strchr(s, ',')) + return TRUE; +return *s == '"'; +}