+eina_str_tolower for lowercasing an entire string in one line

SVN revision: 50361
This commit is contained in:
Mike Blumenkrantz 2010-07-19 01:56:42 +00:00
parent 0c983ac8d8
commit f18e1899e5
2 changed files with 20 additions and 0 deletions

View File

@ -35,6 +35,7 @@ EAPI char *eina_str_convert(const char *enc_from, const char *enc_to, const char
EAPI char *eina_str_escape(const char *str) EINA_WARN_UNUSED_RESULT EINA_MALLOC EINA_ARG_NONNULL(1);
EAPI void eina_str_tolower(char **str);
static inline size_t eina_str_join(char *dst, size_t size, char sep, const char *a, const char *b) EINA_ARG_NONNULL(1, 4, 5);

View File

@ -561,6 +561,25 @@ eina_str_escape(const char *str)
return s2;
}
/**
* @brief Lowercase all the characters in range [A-Z] in the given string.
*
* @param str the string to lowercase
*
* This modifies the original string, changing all characters in [A-Z] to lowercase.
*/
EAPI void
eina_str_tolower(char **str)
{
char *p;
if ((!str) || (!(*str))) return;
for (p = *str; (*p); *p++)
if ((*p >= 'A') && (*p <= 'Z'))
*p = tolower(*p);
}
/**
* @}
*/