Open Lighting Architecture: include/ola/StringUtils.h File Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
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 std::string &input, std::vector< std::string > *tokens, const std::string &delimiters=" ")
| Split a string into pieces.
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::StringBeginsWith (const std::string &s, const std::string &prefix)
| Check if one string is a prefix of another.
bool | ola::StringEndsWith (const std::string &s, const std::string &suffix)
| Check if one string is a suffix of another.
bool | ola::StripPrefix (std::string *s, const std::string &prefix)
| Strips a prefix from a string.
bool | ola::StripSuffix (std::string *s, const std::string &suffix)
| Strips a suffix from a string.
std::string | ola::IntToString (int i)
| Convert an int to a string.
std::string | ola::IntToString (unsigned int i)
string | ola::IntToHexString (unsigned int i, unsigned int width)
std::string | ola::IntToHexString (uint8_t i)
std::string | ola::IntToHexString (uint16_t i)
std::string | ola::IntToHexString (uint32_t i)
void | ola::Escape (std::string *original)
| Escape a string with \ .
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.
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.
bool | ola::StringToBoolTolerant (const std::string &value, bool *output)
| Convert a string to a bool in a tolerant way.
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.
template<typename int_type>
int_type | ola::StringToIntOrDefault (const std::string &value, int_type alternative, bool strict=false)
| Convert a string to an int type or return a default if it failed.
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::CapitalizeFirst (std::string *s)
| Transform a string by capitalizing the first character.
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)
| Convert a hex string, prefixed with 0x or 0X to an int type.
template<typename T>
std::string | ola::StringJoin (const std::string &delim, const T &input)
| Join a vector of a type.