changeset 36987:b33ff300128e

Add new string function strupper().
author ib
date Thu, 27 Mar 2014 02:18:16 +0000
parents 575e1612c53a
children c9ccf9b4a43b
files gui/util/string.c gui/util/string.h
diffstat 2 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gui/util/string.c	Thu Mar 27 02:15:29 2014 +0000
+++ b/gui/util/string.c	Thu Mar 27 02:18:16 2014 +0000
@@ -51,6 +51,29 @@
 }
 
 /**
+ * @brief Convert a string to upper case.
+ *
+ * @param string to be converted
+ *
+ * @return converted string
+ *
+ * @note Only characters from a to z will be converted and this is an in-place conversion.
+ */
+char *strupper(char *in)
+{
+    char *p = in;
+
+    while (*p) {
+        if (*p >= 'a' && *p <= 'z')
+            *p -= 0x20;
+
+        p++;
+    }
+
+    return in;
+}
+
+/**
  * @brief Swap characters in a string.
  *
  * @param in string to be processed
--- a/gui/util/string.h	Thu Mar 27 02:15:29 2014 +0000
+++ b/gui/util/string.h	Thu Mar 27 02:18:16 2014 +0000
@@ -32,6 +32,7 @@
 void setdup(char **old, const char *str);
 char *strlower(char *in);
 char *strswap(char *in, char from, char to);
+char *strupper(char *in);
 char *trim(char *in);
 
 #endif /* MPLAYER_GUI_STRING_H */