guts
string_vector_from_string.cc
Go to the documentation of this file.
1 // gutilities
2 #include "gutilities.h"
3 
4 using namespace gutilities;
5 
6 
7 // c++
8 #include <iostream>
9 
10 using namespace std;
11 
12 
13 int main(int argc, char *argv[]) {
14 
15  if (argc != 2) {
16  cerr << FATALERRORL << "run example with exactly one argument: a quotes enclosed list of strings." << endl;
17  return EXIT_FAILURE;
18 
19  } else {
20  string test = argv[1];
21  vector <string> testResult = getStringVectorFromString(test);
22 
23  cout << " Original String: " << test << endl;
24  cout << " List of items in string: " << endl;
25  for (auto &s: testResult) {
26  cout << SQUAREITEM << s << endl;
27  }
28  }
29 
30  return EXIT_SUCCESS;
31 }
#define FATALERRORL
Fatal error label.
#define SQUAREITEM
Symbol for square item.
vector< std::string > getStringVectorFromString(const std::string &input)
Splits a string into a vector of strings using spaces as delimiters.
Definition: gutilities.cc:54
int main(int argc, char *argv[])