+eina_str_tolower for lowercasing an entire string in one line
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 19 Jul 2010 01:56:42 +0000 (01:56 +0000)
committerdiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 19 Jul 2010 01:56:42 +0000 (01:56 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@50361 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/include/eina_str.h
src/lib/eina_str.c

index 5df9a6c..9556eec 100644 (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);
 
index b27d69d..1833896 100644 (file)
@@ -562,5 +562,24 @@ eina_str_escape(const char *str)
 }
 
 /**
+ * @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);
+}
+
+
+/**
  * @}
  */