Open Lighting Architecture
0.9.0
|
Various string utility functions.
Go to the source code of this file.
Namespaces | |
namespace | ola |
The namespace containing all OLA symbols. |
Functions | |
void | ola::StringSplit (const std::string &input, std::vector< std::string > &tokens, const std::string &delimiters=" ") |
Split a string into pieces. | |
void | ola::StringTrim (std::string *input) |
Trim leading and trailing whitespace from a string. | |
void | ola::ShortenString (std::string *input) |
Truncate the string based on the presence of \0 characters. | |
bool | ola::StringEndsWith (const std::string &s, const std::string &suffix) |
Check if one string is a suffix of another. | |
string | ola::IntToString (int i) |
Convert an int to a string. | |
string | ola::IntToString (unsigned int i) |
void | ola::Escape (std::string *original) |
Escape a string with \ . | |
std::string | ola::EscapeString (const std::string &original) |
Escape a string, returning a copy. | |
void | ola::ReplaceAll (std::string *original, const std::string &find, const std::string &replace) |
Replace all instances of the find string with the replace string. | |
std::string | ola::EncodeString (const std::string &original) |
Encode any unprintable characters in a string as hex, returning a copy. | |
bool | ola::StringToBool (const std::string &value, bool *output) |
Convert a string to a bool. The string can be 'true' or 'false'. | |
bool | ola::StringToInt (const std::string &value, unsigned int *output, bool strict=false) |
Convert a string to a unsigned int. | |
bool | ola::StringToInt (const std::string &value, uint16_t *output, bool strict=false) |
Convert a string to a uint16_t. | |
bool | ola::StringToInt (const std::string &value, uint8_t *output, bool strict=false) |
Convert a string to a uint8_t. | |
bool | ola::StringToInt (const std::string &value, int *output, bool strict=false) |
Convert a string to a int. | |
bool | ola::StringToInt (const std::string &value, int16_t *output, bool strict=false) |
Convert a string to a int16_t. | |
bool | ola::StringToInt (const std::string &value, int8_t *output, bool strict=false) |
Convert a string to a int8_t. | |
bool | ola::HexStringToInt (const std::string &value, uint8_t *output) |
Convert a hex string to a uint8_t. | |
bool | ola::HexStringToInt (const std::string &value, uint16_t *output) |
Convert a hex string to a uint16_t. | |
bool | ola::HexStringToInt (const std::string &value, uint32_t *output) |
Convert a hex string to a uint32_t. | |
bool | ola::HexStringToInt (const std::string &value, int8_t *output) |
Convert a hex string to a int8_t. | |
bool | ola::HexStringToInt (const std::string &value, int16_t *output) |
Convert a hex string to a int16_t. | |
bool | ola::HexStringToInt (const std::string &value, int32_t *output) |
Convert a hex string to a int32_t. | |
void | ola::ToLower (std::string *s) |
Convert a string to lower case. | |
void | ola::ToUpper (std::string *s) |
Convert a string to upper case. | |
void | ola::CapitalizeLabel (std::string *s) |
Transform a string to a pretty-printed form. | |
void | ola::CustomCapitalizeLabel (std::string *s) |
Similar to CapitalizeLabel() but this also capitalized known acronyms. | |
void | ola::FormatData (std::ostream *out, const uint8_t *data, unsigned int length, unsigned int indent=0, unsigned int byte_per_line=8) |
Write binary data to an ostream in a human readable form. | |
template<typename int_type > | |
bool | ola::PrefixedHexStringToInt (const std::string &input, int_type *output) |
template<typename T > | |
std::string | ola::StringJoin (const std::string &delim, const T &input) |
Join a vector of a type. |