1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2013 Index Data
3 * See the file LICENSE for details.
8 * \brief a couple of string utilities
18 #include <yaz/yaz-iconv.h>
19 #include <yaz/matchstr.h>
21 int yaz_strcasecmp(const char *s1, const char *s2)
23 return yaz_strncasecmp(s1, s2, strlen(s1) + 1);
26 int yaz_strncasecmp(const char *s1, const char *s2, size_t n)
30 unsigned char c1 = *s1++;
31 unsigned char c2 = *s2++;
42 int yaz_matchstr(const char *s1, const char *s2)
46 unsigned char c1 = *s1;
47 unsigned char c2 = *s2;
72 int yaz_strcmp_del(const char *a, const char *b, const char *b_del)
81 if (b_del && strchr(b_del, *b))
86 int yaz_memcmp(const void *a, const void *b, size_t len_a, size_t len_b)
88 size_t m_len = len_a < len_b ? len_a : len_b;
89 int r = memcmp(a, b, m_len);
95 int yaz_strcmp_null(const char *v1, const char *v2)
100 return strcmp(v1, v2);
112 * c-file-style: "Stroustrup"
113 * indent-tabs-mode: nil
115 * vim: shiftwidth=4 tabstop=8 expandtab