diff options
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 |