我想知道字符串中"_"的位置:
string str("BLA_BLABLA_BLA.txt");
类似于:
string::iterator it;
for ( it=str.begin() ; it < str.end(); it++ ){
if (*it == "_") //this goes wrong: pointer and integer comparison
{
pos(1) = it;
}
cout << *it << endl;
}
感谢您,André。