summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmSystemTools.cxx15
-rw-r--r--Source/cmSystemTools.h6
2 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7f9bb12..3e9642f 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -316,6 +316,21 @@ bool cmSystemTools::FileExists(const char* filename)
}
+// Return a capitalized string (i.e the first letter is uppercased, all other
+// are lowercased)
+std::string cmSystemTools::Capitalized(std::string& s)
+{
+ std::string n;
+ n.resize(s.size());
+ n[0] = toupper(s[0]);
+ for (size_t i = 1; i < s.size(); i++)
+ {
+ n[i] = tolower(s[i]);
+ }
+ return n;
+}
+
+
// convert windows slashes to unix slashes \ with /
void cmSystemTools::ConvertToUnixSlashes(std::string& path)
{
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 1d5c533..665acc1 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -79,6 +79,12 @@ public:
static std::string EscapeSpaces(const char*);
/**
+ * Return a capitalized string (i.e the first letter is uppercased, all other
+ * are lowercased).
+ */
+ static std::string Capitalized(std::string&);
+
+ /**
* Replace Windows file system slashes with Unix-style slashes.
*/
static void ConvertToUnixSlashes(std::string& path);