Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Functions
StringUtils.h File Reference

Detailed Description

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 string &input, vector< string > &tokens, const string &delimiters=" ")
 Split a string into pieces.
void ola::StringTrim (string *input)
 Trim leading and trailing whitespace from a string.
void ola::ShortenString (string *input)
 Truncate the string based on the presence of \0 characters.
bool ola::StringEndsWith (const string &s, const 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 (string *original)
 Escape a string with \ .
string ola::EscapeString (const string &original)
 Escape a string, returning a copy.
bool ola::StringToBool (const string &value, bool *output)
 Convert a string to a bool. The string can be 'true' or 'false'.
bool ola::StringToInt (const string &value, unsigned int *output, bool strict=false)
 Convert a string to a unsigned int.
bool ola::StringToInt (const string &value, uint16_t *output, bool strict=false)
 Convert a string to a uint16_t.
bool ola::StringToInt (const string &value, uint8_t *output, bool strict=false)
 Convert a string to a uint8_t.
bool ola::StringToInt (const string &value, int *output, bool strict=false)
 Convert a string to a int.
bool ola::StringToInt (const string &value, int16_t *output, bool strict=false)
 Convert a string to a int16_t.
bool ola::StringToInt (const string &value, int8_t *output, bool strict=false)
 Convert a string to a int8_t.
bool ola::HexStringToInt (const string &value, uint8_t *output)
 Convert a hex string to a uint8_t.
bool ola::HexStringToInt (const string &value, uint16_t *output)
 Convert a hex string to a uint16_t.
bool ola::HexStringToInt (const string &value, uint32_t *output)
 Convert a hex string to a uint32_t.
bool ola::HexStringToInt (const string &value, int8_t *output)
 Convert a hex string to a int8_t.
bool ola::HexStringToInt (const string &value, int16_t *output)
 Convert a hex string to a int16_t.
bool ola::HexStringToInt (const string &value, int32_t *output)
 Convert a hex string to a int32_t.
void ola::ToLower (string *s)
 Convert a string to lower case.
void ola::ToUpper (string *s)
 Convert a string to upper case.
void ola::CapitalizeLabel (string *s)
 Transform a string to a pretty-printed form.
void ola::CustomCapitalizeLabel (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 string &input, int_type *output)
template<typename T >
string ola::StringJoin (const string &delim, const T &input)
 Join a vector of a type.