Add str_tolower_inplace() function

This commit is contained in:
Andrew Bettison 2013-10-23 00:57:48 +10:30
parent 95e45f452e
commit 1a413b72db
2 changed files with 10 additions and 0 deletions

8
str.c
View File

@ -123,6 +123,14 @@ char *str_toupper_inplace(char *str)
return str;
}
char *str_tolower_inplace(char *str)
{
register char *s;
for (s = str; *s; ++s)
*s = tolower(*s);
return str;
}
const char *strnchr(const char *s, size_t n, char c)
{
for (; n; --n, ++s) {

2
str.h
View File

@ -92,7 +92,9 @@ __STR_INLINE int hexvalue(char c)
}
int is_all_matching(const unsigned char *ptr, size_t len, unsigned char value);
char *str_toupper_inplace(char *s);
char *str_tolower_inplace(char *s);
char *toprint(char *dstStr, ssize_t dstBufSiz, const char *srcBuf, size_t srcBytes, const char quotes[2]);
char *toprint_str(char *dstStr, ssize_t dstBufSiz, const char *srcStr, const char quotes[2]);