diff options
Diffstat (limited to 'source4/lib/util_str.c')
-rw-r--r-- | source4/lib/util_str.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c index ba952df9f6..1ccdf49dc4 100644 --- a/source4/lib/util_str.c +++ b/source4/lib/util_str.c @@ -663,6 +663,46 @@ char *strrchr_m(const char *s, char c) return ret; } +BOOL strhaslower(const char *string) +{ + while (*string) { + size_t c_size; + codepoint_t s; + codepoint_t t; + + s = next_codepoint(string, &c_size); + string += c_size; + + t = tolower_w(s); + + if (s == t) { /* the source was alreay lower case */ + return True; /* that means it has lower case chars */ + } + } + + return False; +} + +BOOL strhasupper(const char *string) +{ + while (*string) { + size_t c_size; + codepoint_t s; + codepoint_t t; + + s = next_codepoint(string, &c_size); + string += c_size; + + t = toupper_w(s); + + if (s == t) { /* the source was alreay upper case */ + return True; /* that means it has upper case chars */ + } + } + + return False; +} + /** Convert a string to lower case, allocated with talloc **/ |