VCV Rack API v2
Loading...
Searching...
No Matches
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.
 
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::ellipsize (const std::string &s, size_t len)
 Truncates and adds "..." to the end of a string, not exceeding len characters.
 
std::string rack::string::ellipsizePrefix (const std::string &s, size_t len)
 Truncates and adds "..." to the beginning of a string, not exceeding len characters.
 
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)