если есть желание посмотрите вот такую задачку...
Есть код:
Код: Выделить всё
#include <string>
#include <iostream>
#include <cstdlib>
int main(int argc, char *argv[])
{
std::string tmp = "0,0,1.4;0,25,2.0;0,61,2.7;13.4,0,10%;13.4,25,15%;13.4,61,20%;133.4,0,13.4;133.4,25,20.0;133.4,61,26.7";
std::string::size_type s_pos = 0, e_pos = 0;
const char sep = ';';
do
{
e_pos = tmp.find_first_of(&sep, s_pos);
std::string val = tmp.substr(s_pos, e_pos-s_pos);
std::cout << val << std::endl;
s_pos = tmp.find_first_not_of(&sep, e_pos);
}
while(e_pos != std::string::npos);
return 0;
}
выдает следующие результаты:
Код: Выделить всё
0,0,1.4
0,25,2.0
0,61,2.7
13.4,0,10%
13.4,25,15%
13.4,61,2
0%
133.4,0,13.4
133.4,25,20.0
133.4,61,26.7