小编and*_*oer的帖子

计算字符串中的字符出现次数

我如何计算"_"字符串中的数字"bla_bla_blabla_bla"

c++ string pattern-matching

187
推荐指数
7
解决办法
26万
查看次数

C++如何在multimap中插入?

我想在C++中设置一个多图:

multimap<pair<string, string>, vector<double> > mmList;
Run Code Online (Sandbox Code Playgroud)

但是如何插入数据:

mmList.insert(pair<string, string>, vector<double>("a", "b", test));
Run Code Online (Sandbox Code Playgroud)

c++ containers dictionary insert multimap

13
推荐指数
2
解决办法
1万
查看次数

如何在C++字符串中检测"_"?

我想知道字符串中"_"的位置:

string str("BLA_BLABLA_BLA.txt");
Run Code Online (Sandbox Code Playgroud)

就像是:

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;
}
Run Code Online (Sandbox Code Playgroud)

谢谢,安德烈

c++ string search find

5
推荐指数
5
解决办法
516
查看次数