C++ find函数
来源:互联网 发布:华为数据卡槽不能换 编辑:程序博客网 时间:2024/05/29 16:22
#include <iostream>#include <vector>#include <string>#include <algorithm> //find函数所在的头文件using namespace std;int main(){ string str = "you know how much i love you"; if(find(str.begin(),str.end(),'a') != str.end())//find函数多用于容器,查找是否含有特定元素(在此不能是字符串),返回值为迭代器 cout << "yes have" << endl; else cout << "no have" << endl; if(str.find("how") != string::npos) //string 也有自己的find函数,注意:它的最后比较的不能是str.end(),应该是string::npos cout << "ofcourse have" << endl; else cout << "sorry no have" << endl; return 0;}
0 0
- c++find函数
- C++find函数
- c++find函数用法
- c++find函数用法
- c++find函数用法
- C++find函数
- c++find函数
- C/C++ string.find 函数
- c++string.find()函数用法整理
- c++string.find()函数用法
- find函数
- find函数
- find函数
- find()函数
- find函数
- find函数
- 统计单词数(C++stl str.find()函数)
- C++string中用于查找的find系列函数浅析
- MBProgressHUD更改成自定义图片
- Spring获取bean的最简单方法
- 387.The Smallest Difference-最小差(中等题)
- Map与Set的使用little tips
- java基础:多态(0921.2016).
- C++ find函数
- Java-获取本地主机的域名和主机名(net)
- 面向对象的高级编程
- Android屏幕适配经验谈
- 自动化测试(selenium)
- Hibernate多对多操作
- 用异或来交换两个变量是错误的
- Android 权限,权限分组的一些问题
- python 网络编程