Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
StringUtils Namespace Reference


std::vector< std::string > split (const std::string &s, char delimiter, bool removeEmpty=false, unsigned int limit=0)
std::string trim (std::string const &str)
long long int parseAsInt (std::string const &str)
std::vector< char * > makeArgv (std::vector< std::string > &strings)

Detailed Description

Utilities to manipulate strings.

Function Documentation

std::vector<std::string> StringUtils::split ( const std::string &  s,
char  delimiter,
bool  removeEmpty = false,
unsigned int  limit = 0 

Split a string at a given separator.

std::string StringUtils::trim ( std::string const &  str)

Remove leading and trailing spaces from a string.

long long int StringUtils::parseAsInt ( std::string const &  str)

Parses a string as a decimal or hex integer

std::vector<char*> StringUtils::makeArgv ( std::vector< std::string > &  strings)

Turns a vector of strings into a vector of char*, useful for generating argv, with the first element being a nullptr. Note: the pointers are not const char*, because this is the way argv normally is. However, I don't think getopt_long() and the likes actually change the content of the memory locations.

stringsthe vector of strings.
a vector of const char*. Each element points to the memory allocated by each of the elements of strings, and is therefore only valid as long as the latter remains unchanged.