util/StringAPI: add StringToken(), StringIsEqualIgnoreCase(), StringCollate()
This commit is contained in:
parent
60bd60db03
commit
907fb257cd
|
@ -94,6 +94,12 @@ StringFindLast(char *haystack, char needle) noexcept
|
|||
return strrchr(haystack, needle);
|
||||
}
|
||||
|
||||
static inline char *
|
||||
StringToken(char *str, const char *delim) noexcept
|
||||
{
|
||||
return strtok(str, delim);
|
||||
}
|
||||
|
||||
gcc_nonnull_all
|
||||
static inline void
|
||||
UnsafeCopyString(char *dest, const char *src) noexcept
|
||||
|
@ -134,6 +140,27 @@ StringIsEqual(const char *a, const char *b, size_t length) noexcept
|
|||
return strncmp(a, b, length) == 0;
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static inline bool
|
||||
StringIsEqualIgnoreCase(const char *a, const char *b) noexcept
|
||||
{
|
||||
return strcasecmp(a, b) == 0;
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static inline bool
|
||||
StringIsEqualIgnoreCase(const char *a, const char *b, size_t size) noexcept
|
||||
{
|
||||
return strncasecmp(a, b, size) == 0;
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
static inline int
|
||||
StringCollate(const char *a, const char *b) noexcept
|
||||
{
|
||||
return strcoll(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the string to a new allocation. The return value must be
|
||||
* freed with free().
|
||||
|
|
Loading…
Reference in New Issue