9df48bcdd35df301c8b97ef88479b3f8b5f348d5 braney Wed Oct 24 13:42:53 2018 -0700 add a routine to chop on commas that allows the inclusion of escaped commas diff --git src/inc/common.h src/inc/common.h index 985676c..de255cc 100644 --- src/inc/common.h +++ src/inc/common.h @@ -565,30 +565,37 @@ struct slName *slNameAddTail(struct slName **pList, char *name); /* Add name to end of list (not efficient for long lists), * and return it. */ struct slName *slNameCloneList(struct slName *list); /* Return clone of list. */ struct slName *slNameListFromString(char *s, char delimiter); /* Return list of slNames gotten from parsing delimited string. * The final delimiter is optional. a,b,c and a,b,c, are equivalent * for comma-delimited lists. */ #define slNameListFromComma(s) slNameListFromString(s, ',') /* Parse out comma-separated list. */ +struct slName *slNameListFromCommaEscaped(char *s); +/* Return list of slNames gotten from parsing comma delimited string. + * The final comma is optional. a,b,c and a,b,c, are equivalent + * for comma-delimited lists. To escape commas, put two in a row, + * which eliminates the possibility for null names + * (eg. a,,b,c will parse to two elements a,b and c). */ + struct slName *slNameListFromStringArray(char *stringArray[], int arraySize); /* Return list of slNames from an array of strings of length arraySize. * If a string in the array is NULL, the array will be treated as * NULL-terminated. */ char *slNameListToString(struct slName *list, char delimiter); /* Return string created by joining all names with the delimiter. */ struct slName *slNameLoadReal(char *fileName); /* load file lines that are not blank or start with a '#' into a slName * list */ struct slName *slNameIntersection(struct slName *a, struct slName *b); /* return intersection of two slName lists. */