浏览代码

ENH: Added LowerCase method.

Bill Lorensen 24 年之前
父节点
当前提交
1e9fbdc38c
共有 2 个文件被更改,包括 18 次插入0 次删除
  1. 13 0
      Source/cmSystemTools.cxx
  2. 5 0
      Source/cmSystemTools.h

+ 13 - 0
Source/cmSystemTools.cxx

@@ -417,6 +417,19 @@ std::string cmSystemTools::Capitalized(const std::string& s)
 }
 
 
+// Return a lower case string 
+std::string cmSystemTools::LowerCase(const std::string& s)
+{
+  std::string n;
+  n.resize(s.size());
+  for (size_t i = 0; i < s.size(); i++)
+    {
+    n[i] = tolower(s[i]);
+    }
+  return n;
+}
+
+
 // convert windows slashes to unix slashes \ with /
 const char *cmSystemTools::ConvertToUnixSlashes(std::string& path)
 {

+ 5 - 0
Source/cmSystemTools.h

@@ -95,6 +95,11 @@ public:
    */
   static std::string Capitalized(const std::string&);
   
+  /**
+   * Return a lower case string
+   */
+  static std::string LowerCase(const std::string&);
+  
   /**
    * Replace Windows file system slashes with Unix-style slashes.
    */