123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #include <string.h>
- #include <ctype.h>
- #include "private.h"
- #include "lub/ctype.h"
- int lub_string_nocasecmp(const char *cs, const char *ct)
- {
- int result = 0;
- while ((0 == result) && *cs && *ct) {
-
- int s = lub_ctype_tolower(*cs++);
- int t = lub_ctype_tolower(*ct++);
- result = s - t;
- }
-
- if (0 == result) {
-
- result = *cs - *ct;
- }
- return result;
- }
- char *lub_string_tolower(const char *str)
- {
- char *tmp = strdup(str);
- char *p = tmp;
- while (*p) {
- *p = tolower(*p);
- p++;
- }
- return tmp;
- }
|