add PBD::downcase() functions to libpbd
This commit is contained in:
@@ -18,6 +18,9 @@
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdio>
|
||||
@@ -51,6 +54,24 @@ capitalize (const string& str)
|
||||
return ret;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -40,6 +40,8 @@ LIBPBD_API double atof (const std::string&);
|
||||
LIBPBD_API std::string url_decode (std::string const &);
|
||||
|
||||
LIBPBD_API std::string capitalize (const std::string&);
|
||||
LIBPBD_API std::string downcase (const std::string&);
|
||||
LIBPBD_API const char* downcase (const char*);
|
||||
|
||||
// std::string length2string (const int32_t frames, const float sample_rate);
|
||||
LIBPBD_API std::string length2string (const int64_t frames, const double sample_rate);
|
||||
|
||||
Reference in New Issue
Block a user