7a9ec1f838c6a2546278075ffe575fc950ef0b45 kent Tue Dec 14 20:58:27 2021 -0800 Addng slName sorting function that ignores case and sorts numbers. diff --git src/lib/common.c src/lib/common.c index d874e27..4117d43 100644 --- src/lib/common.c +++ src/lib/common.c @@ -697,30 +697,39 @@ { const struct slName *a = *((struct slName **)va); const struct slName *b = *((struct slName **)vb); return strcmp(a->name, b->name); } int slNameCmpStringsWithEmbeddedNumbers(const void *va, const void *vb) /* Compare strings such as gene names that may have embedded numbers, * so that bmp4a comes before bmp14a */ { const struct slName *a = *((struct slName **)va); const struct slName *b = *((struct slName **)vb); return cmpStringsWithEmbeddedNumbers(a->name, b->name); } +int slNameCmpWordsWithEmbeddedNumbers(const void *va, const void *vb) +/* Compare strings such as gene names that may have embedded numbers, + * in a string sensitive way so that bmp4a comes before bmp14a + * and ABc and abC are treated as the same. A little slow. */ +{ +const struct slName *a = *((struct slName **)va); +const struct slName *b = *((struct slName **)vb); +return cmpWordsWithEmbeddedNumbers(a->name, b->name); +} void slNameSort(struct slName **pList) /* Sort slName list. */ { slSort(pList, slNameCmp); } boolean slNameInList(struct slName *list, char *string) /* Return true if string is in name list -- case insensitive. */ { struct slName *el; for (el = list; el != NULL; el = el->next) if (sameWord(string, el->name)) return TRUE;