diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-03-10 17:26:06 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-03-10 17:30:12 -0400 |
commit | b6a9bf5d043bf74cdb5aebc11b54e0c187e225ad (patch) | |
tree | e7f3e118ea42866e48c758b3140d17c696ee3496 /libs/pbd/convert.cc | |
parent | 5ccf1e7346c737b35a06969c9d46da22f088dad2 (diff) |
add PBD::downcase() functions to libpbd
Diffstat (limited to 'libs/pbd/convert.cc')
-rw-r--r-- | libs/pbd/convert.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/pbd/convert.cc b/libs/pbd/convert.cc index 1787d3b70d..940aa87189 100644 --- a/libs/pbd/convert.cc +++ b/libs/pbd/convert.cc @@ -18,6 +18,9 @@ */ #include <cmath> +#include <algorithm> +#include <string> + #include <stdint.h> #include <stdlib.h> #include <cstdio> @@ -52,6 +55,24 @@ capitalize (const string& str) } string +downcase (const string& str) +{ + string copy (str); + std::transform (copy.begin(), copy.end(), copy.begin(), ::tolower); + return copy; +} + +const char* +downcase (const char* str) +{ + char *copy = strdup (str); + for (char* p = copy; *p; ++p) { + *p = tolower (*p); + } + return copy; +} + +string short_version (string orig, string::size_type target_length) { /* this tries to create a recognizable abbreviation |