aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/StringUtil.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/StringUtil.cc')
-rw-r--r--src/FbTk/StringUtil.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc
index 869a3b5..9b4928b 100644
--- a/src/FbTk/StringUtil.cc
+++ b/src/FbTk/StringUtil.cc
@@ -233,6 +233,18 @@ string::size_type removeTrailingWhitespace(string &str) {
233 return first_pos; 233 return first_pos;
234} 234}
235 235
236void getFirstWord(const std::string &in, std::string &word, std::string &rest) {
237 word = in;
238 string::size_type first_pos = StringUtil::removeFirstWhitespace(word);
239 string::size_type second_pos = word.find_first_of(" \t", first_pos);
240 if (second_pos != string::npos) {
241 rest = word.substr(second_pos);
242 word.erase(second_pos);
243 removeFirstWhitespace(rest);
244 removeTrailingWhitespace(rest);
245 }
246}
247
236}; // end namespace StringUtil 248}; // end namespace StringUtil
237 249
238}; // end namespace FbTk 250}; // end namespace FbTk