17std::string f(
const char*
format, ...);
18std::string
fV(
const char*
format, va_list args);
24std::string
trim(
const std::string& s);
26std::string
ellipsize(
const std::string& s,
size_t len);
30bool startsWith(
const std::string& str,
const std::string& prefix);
32bool endsWith(
const std::string& str,
const std::string& suffix);
37std::string
toBase64(
const uint8_t* data,
size_t dataLen);
38std::string
toBase64(
const std::vector<uint8_t>& data);
46 bool operator()(
const std::string& a,
const std::string& b)
const;
51template <
typename TContainer>
52std::string
join(
const TContainer& container, std::string seperator =
"") {
55 for (
const auto& c : container) {
74std::vector<std::string>
split(
const std::string& s,
const std::string& seperator,
size_t maxTokens = 0);
88std::string UTF16toUTF8(
const std::wstring& w);
89std::wstring UTF8toUTF16(
const std::string& s);
118 operator std::string()
const;
__attribute__((format(printf, 5, 6))) void log(Level level
Do not use this function directly.
const char int const char const char * format
Definition logger.hpp:41
std::string formatTimeISO(double timestamp)
std::string ellipsizePrefix(const std::string &s, size_t len)
Truncates and adds "..." to the beginning of a string, not exceeding len characters.
std::string ellipsize(const std::string &s, size_t len)
Truncates and adds "..." to the end of a string, not exceeding len characters.
std::string toBase64(const uint8_t *data, size_t dataLen)
Converts a byte array to a Base64-encoded string.
std::vector< uint8_t > fromBase64(const std::string &str)
Converts a Base64-encoded string to a byte array.
__attribute__((format(printf, 1, 2))) std std::string fV(const char *format, va_list args)
Converts a printf() format string and optional arguments into a std::string.
bool endsWith(const std::string &str, const std::string &suffix)
Returns whether a string ends with the given substring.
std::vector< std::string > split(const std::string &s, const std::string &seperator, size_t maxTokens=0)
Splits a string into a vector of tokens.
bool startsWith(const std::string &str, const std::string &prefix)
Returns whether a string starts with the given substring.
std::string join(const TContainer &container, std::string seperator="")
Joins an container (vector, list, etc) of std::strings with an optional separator string.
Definition string.hpp:52
std::string uppercase(const std::string &s)
Replaces all characters to uppercase letters.
std::string trim(const std::string &s)
Removes whitespace from beginning and end of string.
std::string lowercase(const std::string &s)
Replaces all characters to lowercase letters.
std::string formatTime(const char *format, double timestamp)
Formats a UNIX timestamp with a strftime() string.
Root namespace for the Rack API.
Definition AudioDisplay.hpp:9
const C::mapped_type & get(const C &c, const typename C::key_type &key, const typename C::mapped_type &def=typename C::mapped_type())
Given a std::map c, returns the value of the given key, or returns def if the key doesn't exist.
Definition common.hpp:248
bool operator()(const std::string &a, const std::string &b) const
Returns whether a < b using case-insensitive lexical comparison.
Structured version string, for comparison.
Definition string.hpp:112
std::string getMinor() const
Definition string.hpp:125
std::string getRevision() const
Definition string.hpp:128
Version()
Definition string.hpp:115
operator std::string() const
std::string getMajor() const
Definition string.hpp:122
bool operator<(const Version &other)
Returns whether this version is earlier than other.
Version(const std::string &s)
std::vector< std::string > parts
Definition string.hpp:113
Version(const char *s)
Definition string.hpp:117