useful functions: split string to double added
parent
f29ac7aa84
commit
0de3d0caf0
|
@ -89,3 +89,19 @@ std::vector<float> SplitString2Float(std::string str, std::string delimiter)
|
||||||
}
|
}
|
||||||
return v_f;
|
return v_f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<double> SplitString2Double(std::string str, std::string delimiter)
|
||||||
|
{
|
||||||
|
std::vector<double> v_f;
|
||||||
|
std::vector<std::string> results;
|
||||||
|
boost::split(results, str, boost::is_any_of(delimiter));
|
||||||
|
|
||||||
|
for (size_t n=0;n<results.size();++n)
|
||||||
|
{
|
||||||
|
std::istringstream is(results.at(n));
|
||||||
|
double num;
|
||||||
|
if (is >> num)
|
||||||
|
v_f.push_back(num);
|
||||||
|
}
|
||||||
|
return v_f;
|
||||||
|
}
|
||||||
|
|
|
@ -31,5 +31,6 @@ double CalcNyquistFrequency(unsigned int nyquist, double dT);
|
||||||
std::vector<unsigned int> AssignJobs2Threads(unsigned int jobs, unsigned int nrThreads, bool RemoveEmpty=false);
|
std::vector<unsigned int> AssignJobs2Threads(unsigned int jobs, unsigned int nrThreads, bool RemoveEmpty=false);
|
||||||
|
|
||||||
std::vector<float> SplitString2Float(std::string str, std::string delimiter=",");
|
std::vector<float> SplitString2Float(std::string str, std::string delimiter=",");
|
||||||
|
std::vector<double> SplitString2Double(std::string str, std::string delimiter=",");
|
||||||
|
|
||||||
#endif // USEFUL_H
|
#endif // USEFUL_H
|
||||||
|
|
Loading…
Reference in New Issue