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