From 0de3d0caf040fa9e6f432115a56144e74fac8721 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Mon, 17 Sep 2012 11:51:19 +0200 Subject: [PATCH] useful functions: split string to double added --- tools/useful.cpp | 16 ++++++++++++++++ tools/useful.h | 1 + 2 files changed, 17 insertions(+) diff --git a/tools/useful.cpp b/tools/useful.cpp index 601c97a..bbde8d1 100644 --- a/tools/useful.cpp +++ b/tools/useful.cpp @@ -89,3 +89,19 @@ std::vector SplitString2Float(std::string str, std::string delimiter) } return v_f; } + +std::vector SplitString2Double(std::string str, std::string delimiter) +{ + std::vector v_f; + std::vector results; + boost::split(results, str, boost::is_any_of(delimiter)); + + for (size_t n=0;n> num) + v_f.push_back(num); + } + return v_f; +} diff --git a/tools/useful.h b/tools/useful.h index 770f2e9..9008f74 100644 --- a/tools/useful.h +++ b/tools/useful.h @@ -31,5 +31,6 @@ double CalcNyquistFrequency(unsigned int nyquist, double dT); std::vector AssignJobs2Threads(unsigned int jobs, unsigned int nrThreads, bool RemoveEmpty=false); std::vector SplitString2Float(std::string str, std::string delimiter=","); +std::vector SplitString2Double(std::string str, std::string delimiter=","); #endif // USEFUL_H