26 return !std::isspace(ch);
41 const auto end = std::find_if(text.begin(), text.end(),
not_a_space);
42 text.erase(text.begin(), end);
49 const auto rbegin = std::find_if(text.rbegin(), text.rend(),
not_a_space);
50 const auto begin = rbegin.base();
51 text.erase(begin, text.end());
64 const std::string text_str(text);
82 const std::string text_str(text);
95 const std::string text_str(text);
108 const std::string text_str(text);
109 return quote(text_str, quote_character);
115 std::stringstream quoted_text;
116 quoted_text << quote_character << text << quote_character;
117 return quoted_text.str();
123 const std::string text_str(text);
131 text.substr(1, text.size() - 2)
138 const std::string csv_list_str(csvList);
139 return split(csv_list_str, separator);
145 std::vector<std::string> parts;
153 std::size_t start = 0;
154 std::size_t end = csvList.find(separator);
155 while (end != std::string::npos)
158 const std::size_t length = end - start;
159 const std::string part = csvList.substr(start, length);
160 parts.emplace_back(part);
165 end = csvList.find(separator, start);
169 const std::string part = csvList.substr(start);
170 parts.emplace_back(part);
rohdeschwarz helper function definition
std::string unquote(const char *text)
Removes quotes from beginning and end of string.
bool isRightQuote(const char *text)
Checks for a quote at the end of the string.
std::string trim(const std::string &text)
Trims whitespace beginning and end of string.
std::string quote(const char *text, char quote_character='\'')
Surrounds string in quotes.
bool isLeftQuote(const char *text)
Checks for a quote at the beginning of the string.
std::vector< std::string > split(const char *csvList, const char separator=',')
Splits string on separator.
std::string leftTrim(std::string text)
Trims whitespace from left (beginning) of string.
bool isQuoted(const char *text)
Checks for quotes at the beginning and end of the string.
std::string rightTrim(std::string text)
Trims whitespace from right (end) of string.