From ab11eab71eb5bfae5a93bde7a41183425b3d76ea Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Fri, 30 Oct 2015 15:56:04 +0100 Subject: [PATCH] test driver for stringtokens --- src/utils/smallut.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/utils/smallut.cpp b/src/utils/smallut.cpp index 2a23c962..8a4bb550 100644 --- a/src/utils/smallut.cpp +++ b/src/utils/smallut.cpp @@ -1264,7 +1264,19 @@ int main(int argc, char **argv) { thisprog = *argv++;argc--; -#if 0 +#if 1 + if (argc <=0 ) { + cerr << "Usage: smallut " << endl; + exit(1); + } + string s = *argv++;argc--; + vector vs; + stringToTokens(s, vs, "/"); + for (vector::const_iterator it = vs.begin(); it != vs.end(); it++) + cerr << "[" << *it << "] "; + cerr << endl; + exit(0); +#elif 0 if (argc <=0 ) { cerr << "Usage: smallut " << endl; exit(1); @@ -1369,7 +1381,7 @@ int main(int argc, char **argv) string out; stringsToCSV(tokens, out); cout << "CSV line: [" << out << "]" << endl; -#elif 1 +#elif 0 string sshort("ABC"); string slong("ABCD"); string sshortsmaller("ABB");