Loading [MathJax]/extensions/tex2jax.js
VCV Rack API v2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
string.hpp File Reference
#include <stdarg.h>
#include <vector>
#include <common.hpp>
Include dependency graph for string.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rack::string::CaseInsensitiveCompare
 
struct  rack::string::Version
 Structured version string, for comparison. More...
 

Namespaces

namespace  rack
 Root namespace for the Rack API.
 
namespace  rack::string
 Supplemental std::string functions.
 

Functions

__attribute__((format(printf, 1, 2))) std std::string rack::string::fV (const char *format, va_list args)
 Converts a printf format string and optional arguments into a std::string.
 
template<typename T>
rack::string::convertFArg (const T &t)
 
const char * rack::string::convertFArg (const std::string &s)
 
template<typename... Args>
std::string rack::string::f (Args... args)
 
std::string rack::string::lowercase (const std::string &s)
 Replaces all characters to lowercase letters.
 
std::string rack::string::uppercase (const std::string &s)
 Replaces all characters to uppercase letters.
 
std::string rack::string::trim (const std::string &s)
 Removes whitespace from beginning and end of string.
 
std::string rack::string::truncate (const std::string &s, size_t maxCodepoints)
 Truncates a string to not exceed a number of UTF-8 codepoints.
 
std::string rack::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 rack::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 rack::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.
 
bool rack::string::startsWith (const std::string &str, const std::string &prefix)
 Returns whether a string starts with the given substring.
 
bool rack::string::endsWith (const std::string &str, const std::string &suffix)
 Returns whether a string ends with the given substring.
 
std::string rack::string::toBase64 (const uint8_t *data, size_t dataLen)
 Converts a byte array to a Base64-encoded string.
 
std::string rack::string::toBase64 (const std::vector< uint8_t > &data)
 
std::vector< uint8_t > rack::string::fromBase64 (const std::string &str)
 Converts a Base64-encoded string to a byte array.
 
template<typename TContainer>
std::string rack::string::join (const TContainer &container, std::string seperator="")
 Joins an container (vector, list, etc) of std::strings with an optional separator string.
 
std::vector< std::string > rack::string::split (const std::string &s, const std::string &seperator, size_t maxTokens=0)
 Splits a string into a vector of tokens.
 
std::string rack::string::formatTime (const char *format, double timestamp)
 Formats a UNIX timestamp with a strftime() string.
 
std::string rack::string::formatTimeISO (double timestamp)
 
std::string rack::string::UTF32toUTF8 (const std::u32string &s32)
 Converts a UTF-32 string to a UTF-8 string.
 
std::u32string rack::string::UTF8toUTF32 (const std::string &s8)
 Converts a UTF-8 string to a UTF-32 string.
 
size_t rack::string::UTF8NextCodepoint (const std::string &s8, size_t pos)
 Finds the byte position of the next codepoint in a valid UTF-8 string.
 
size_t rack::string::UTF8PrevCodepoint (const std::string &s8, size_t pos)
 Finds the byte position of the previous codepoint in a valid UTF-8 string.
 
size_t rack::string::UTF8Length (const std::string &s8)
 Returns the number of codepoints in a valid UTF-8 string.
 
size_t rack::string::UTF8CodepointIndex (const std::string &s8, size_t pos)
 Returns a codepoint's index in a valid UTF-8 string.
 
size_t rack::string::UTF8CodepointPos (const std::string &s8, size_t index)
 Returns a codepoint's byte position in a valid UTF-8 string.
 
std::string rack::string::translate (const std::string &id)
 Returns translation string of the current language setting from translations/<language>.json, or English if not found.
 
std::string rack::string::translate (const std::string &id, const std::string &language)
 Returns translation string of the given language, or "" if not found.
 
std::vector< std::string > rack::string::getLanguages ()
 Returns ISO 639-1 language codes of loaded translations, sorted by name of language.
 
void rack::string::init ()