void SplitString(const std::string& s, std::vector<std::string>& v, const std::string& c)
{
std::string::size_type pos1, pos2;
pos2 = s.find(c);
pos1 = 0;
while (std::string::npos != pos2)
{
v.push_back(s.substr(pos1, pos2 - pos1));
pos1 = pos2 + c.size();
pos2 = s.find(c, pos1);
}
if (pos1 != s.length())
v.push_back(s.substr(pos1));
}
std::vector<std::string> vecSTR;
SplitString(strSS, vecSTR, ",");//调用自定义的SplitString函数对字符串进行分割
double wcsX;
sscanf(vecSTR[4].c_str(), "%lf", &wcsX);
double wcsY;
sscanf(vecSTR[5].c_str(), "%lf", &wcsY);
double wcsZ;
sscanf(vecSTR[6].c_str(), "%lf", &wcsZ);
double note_origin[3];
note_origin[0] = wcsX;
note_origin[1] = wcsY;
note_origin[2] = wcsZ;
标签:std,vecSTR,自定义,字符串,SplitString,pos2,origin,pos1 From: https://www.cnblogs.com/firetuo/p/17132300.html