17std::string
f(
const char*
format, ...);
18std::string
fV(
const char*
format, va_list args);
23inline const char*
convertFArg(
const std::string& s) {
return s.c_str();}
24template<
typename... Args>
25std::string
f(Args... args) {
27 typedef std::string (*FType)(
const char*
format, ...);
25std::string
f(Args... args) {
…}
36std::string
trim(
const std::string& s);
38std::string
truncate(
const std::string& s,
size_t maxCodepoints);
42std::string
ellipsize(
const std::string& s,
size_t maxCodepoints);
46bool startsWith(
const std::string& str,
const std::string& prefix);
48bool endsWith(
const std::string& str,
const std::string& suffix);
53std::string
toBase64(
const uint8_t* data,
size_t dataLen);
54std::string
toBase64(
const std::vector<uint8_t>& data);
62 bool operator()(
const std::string& a,
const std::string& b)
const;
67template <
typename TContainer>
68std::string
join(
const TContainer& container, std::string seperator =
"") {
71 for (
const auto& c : container) {
68std::string
join(
const TContainer& container, std::string seperator =
"") {
…}
90std::vector<std::string>
split(
const std::string& s,
const std::string& seperator,
size_t maxTokens = 0);
137std::string UTF16toUTF8(
const std::wstring& w);
138std::wstring UTF8toUTF16(
const std::string& s);
167 operator std::string()
const;
186std::string
translate(
const std::string&
id,
const std::string& language);
__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
Supplemental std::string functions.
Definition string.hpp:10
std::string formatTimeISO(double timestamp)
std::string truncatePrefix(const std::string &s, size_t maxCodepoints)
Truncates the beginning of a string to not exceed a number of UTF-8 codepoints.
std::string f(Args... args)
Definition string.hpp:25
std::string ellipsize(const std::string &s, size_t maxCodepoints)
Truncates and adds "…" to the end of a string, to not exceed a number of UTF-8 codepoints.
std::string toBase64(const uint8_t *data, size_t dataLen)
Converts a byte array to a Base64-encoded string.
std::string UTF32toUTF8(const std::u32string &s32)
Converts a UTF-32 string to a UTF-8 string.
std::vector< uint8_t > fromBase64(const std::string &str)
Converts a Base64-encoded string to a byte array.
std::string ellipsizePrefix(const std::string &s, size_t maxCodepoints)
Truncates and adds "…" to the beginning of a string, to not exceed a number of UTF-8 codepoints.
std::u32string UTF8toUTF32(const std::string &s8)
Converts a UTF-8 string to a UTF-32 string.
__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.
std::string translate(const std::string &id)
Returns translation string of the current language setting from translations/<language>....
std::vector< std::string > getLanguages()
Returns ISO 639-1 language codes of loaded translations, sorted by name of language.
bool endsWith(const std::string &str, const std::string &suffix)
Returns whether a string ends with the given substring.
size_t UTF8CodepointPos(const std::string &s8, size_t index)
Returns a codepoint's byte position in a valid UTF-8 string.
T convertFArg(const T &t)
Definition string.hpp:22
std::string truncate(const std::string &s, size_t maxCodepoints)
Truncates a string to not exceed a number of UTF-8 codepoints.
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.
size_t UTF8NextCodepoint(const std::string &s8, size_t pos)
Finds the byte position of the next codepoint in a valid UTF-8 string.
size_t UTF8Length(const std::string &s8)
Returns the number of codepoints in a valid UTF-8 string.
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:68
std::string uppercase(const std::string &s)
Replaces all characters to uppercase letters.
size_t UTF8PrevCodepoint(const std::string &s8, size_t pos)
Finds the byte position of the previous codepoint in a valid UTF-8 string.
size_t UTF8CodepointIndex(const std::string &s8, size_t pos)
Returns a codepoint's index in a valid UTF-8 string.
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:240
bool operator()(const std::string &a, const std::string &b) const
Returns whether a < b using case-insensitive lexical comparison.
std::string getMinor() const
Definition string.hpp:174
std::string getRevision() const
Definition string.hpp:177
Version()
Definition string.hpp:164
operator std::string() const
std::string getMajor() const
Definition string.hpp:171
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:162
Version(const char *s)
Definition string.hpp:166