浏览代码

Added G_store_upper/lower()

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@60203 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho 11 年之前
父节点
当前提交
fe49a9e273
共有 1 个文件被更改,包括 48 次插入0 次删除
  1. 48 0
      lib/gis/strings.c

+ 48 - 0
lib/gis/strings.c

@@ -100,6 +100,54 @@ char *G_store(const char *s)
 }
 
 /*!
+  \brief Copy string to allocated memory and convert copied string
+  to upper case
+  
+  This routine allocates enough memory to hold the string <b>s</b>,
+  copies <em>s</em> to the allocated memory, and returns a pointer
+  to the allocated memory.
+  
+  If <em>s</em> is NULL then empty string is returned.
+  
+  \param s string
+ 
+  \return pointer to newly allocated upper case string
+*/
+char *G_store_upper(const char *s)
+{
+    char *u_s;
+
+    u_s = G_store(s);
+    G_str_to_upper(u_s);
+
+    return u_s;
+}
+
+/*!
+  \brief Copy string to allocated memory and convert copied string
+  to lower case
+  
+  This routine allocates enough memory to hold the string <b>s</b>,
+  copies <em>s</em> to the allocated memory, and returns a pointer
+  to the allocated memory.
+  
+  If <em>s</em> is NULL then empty string is returned.
+  
+  \param s string
+ 
+  \return pointer to newly allocated lower case string
+*/
+char *G_store_lower(const char *s)
+{
+    char *l_s;
+
+    l_s = G_store(s);
+    G_str_to_lower(l_s);
+
+    return l_s;
+}
+
+/*!
   \brief Replace all occurencies of character in string bug with new
   
   \param[in,out] bug base string