Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
Loading...
Searching...
No Matches
StringUtils Namespace Reference

Functions

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

◆ split()

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.

◆ trim()

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

Remove leading and trailing spaces from a string.

◆ parseAsInt()

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

Parses a string as a decimal or hex integer

◆ makeArgv()

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.

Parameters
stringsthe vector of strings.
Returns
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.