📅  最后修改于: 2022-03-11 14:44:58.138000             🧑  作者: Mango
std::string s = "Hola-perro-Cosa";
int init = 0;
int end = 0;
while( end = s.find("-", init), end >= 0 )
{
std::cout << s.substr(init, end - init) << '\n';
init = end + 1;
}
std::cout << s.substr(init);