guts
Loading...
Searching...
No Matches
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
}
gutilities.h
gutsConventions.h
FATALERRORL
#define FATALERRORL
Fatal error label.
Definition
gutsConventions.h:79
SQUAREITEM
#define SQUAREITEM
Symbol for square item.
Definition
gutsConventions.h:88
gutilities::getStringVectorFromString
vector< std::string > getStringVectorFromString(const std::string &input)
Splits a string into a vector of strings using spaces as delimiters.
Definition
gutilities.cc:56
main
int main(int argc, char *argv[])
Definition
string_vector_from_string.cc:10
examples
string_vector_from_string.cc
Generated by
1.10.0