9#ifndef MRPT_STRING_UTILS_H
10#define MRPT_STRING_UTILS_H
43 const std::string & inString,
44 const std::string & inDelimiters,
45 std::deque<std::string> & outTokens,
49 const
std::
string & inString,
50 const
std::
string & inDelimiters,
51 std::vector<
std::
string> & outTokens,
105 template <typename T>
108 std::string ret =
"[";
109 typename T::const_iterator it=V.begin();
std::vector< uint8_t > vector_byte
std::vector< uint16_t > vector_word
void BASE_IMPEXP encodeUTF8(const vector_word &input, std::string &output)
Encodes a 2-bytes UNICODE string into a UTF-8 string.
std::string BASE_IMPEXP trim(const std::string &str)
Removes leading and trailing spaces.
void BASE_IMPEXP decodeUTF8(const std::string &strUTF8, vector_word &out_uniStr)
Decodes a UTF-8 string into an UNICODE string.
bool BASE_IMPEXP strCmpI(const std::string &s1, const std::string &s2)
Return true if the two strings are equal (case insensitive)
void BASE_IMPEXP encodeBase64(const vector_byte &inputData, std::string &outString)
Encode a sequence of bytes as a string in base-64.
std::string BASE_IMPEXP upperCase(const std::string &str)
Returns a lower-case version of a string.
std::string BASE_IMPEXP unitsFormat(const double val, int nDecimalDigits=2, bool middle_space=true)
This function implements formatting with the appropriate SI metric unit prefix: 1e-12->'p',...
bool BASE_IMPEXP strStarts(const std::string &str, const std::string &subStr)
Return true if "str" starts with "subStr" (case sensitive)
char BASE_IMPEXP * strtok(char *str, const char *strDelimit, char **context) MRPT_NO_THROWS
An OS-independent method for tokenizing a string.
bool BASE_IMPEXP strCmp(const std::string &s1, const std::string &s2)
Return true if the two strings are equal (case sensitive)
bool BASE_IMPEXP strStartsI(const std::string &str, const std::string &subStr)
Return true if "str" starts with "subStr" (case insensitive)
void BASE_IMPEXP tokenize(const std::string &inString, const std::string &inDelimiters, std::deque< std::string > &outTokens, bool skipBlankTokens=true) MRPT_NO_THROWS
Tokenizes a string according to a set of delimiting characters.
bool BASE_IMPEXP decodeBase64(const std::string &inString, vector_byte &outData)
Decode a base-64 string into the original sequence of bytes.
std::string sprintf_container(const char *fmt, const T &V)
Generates a string for a container in the format [A,B,C,...], and the fmt string for each vector elem...
std::string BASE_IMPEXP rightPad(const std::string &str, const size_t total_len, bool truncate_if_larger=false)
Enlarge the string with spaces up to the given length.
std::string BASE_IMPEXP lowerCase(const std::string &str)
Returns an upper-case version of a string.
#define MRPT_NO_THROWS
Used after member declarations.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.