string::find_first_not_of
| string (1) |
size_t find_first_not_of (const string& str, size_t pos = 0) const noexcept; |
|---|---|
| c-string (2) |
size_t find_first_not_of (const char* s, size_t pos = 0) const; |
| buffer (3) |
size_t find_first_not_of (const char* s, size_t pos, size_t n) const; |
| character (4) |
size_t find_first_not_of (char c, size_t pos = 0) const noexcept; |
功能:查找在前面出现后面没有的位置
返回值:成功返回找到的位置,没找到返回string::npos
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s1("abcde");
string s2("aaccbbddeeff");
size_t n = s2.find_first_not_of(s1);
cout << n << endl;
const char *s3 = "abcdefghij";
string s4("mabcdefghijk");
cout << s4.find_first_not_of(s3) << endl;
cout << s4.find_first_not_of(s3, 1) << endl;
cout << s4.find_first_not_of(s3, 1, 5) << endl;
string s5("mabcdefghij");
cout << (n = s5.find_first_not_of(s3, 1)) << endl;
if(n == string::npos)
cout << "not found diffence string::npos" << endl;
return 0;
}
string::find_first_not_of的更多相关文章
- C++ string 类详解
字符串是存储在内存的连续字节中的一系列字符.C++ 处理字符串的方式有两种,一种来自 C 语言,常被称为 C-风格字符串,另一种是基于 string 类库的字符串处理方式.C 风格字符串的处理可以参考 ...
- std::string::find_last_not_of
public member function <string> std::string::find_last_not_of C++98 C++11 string (1) size_t fi ...
- 关于string类中find函数的讲解
以下所讲的所有的string查找函数,都有唯一的返回类型,那就是size_type,即一个无符号整数(按打印出来的算).若查找成功,返回按查找规则找到的第一个字符或子串的位置:若查找失败,返回npos ...
- C++ string类型小结
目录 构造函数 string.append() string.assign() string.at() string.back() string.begin() string.capasity() s ...
- 面试总结之C/C++
source code https://github.com/haotang923/interview/blob/master/interview%20summary%20of%20C%20and%2 ...
- STL顺序容器用法自我总结
顺序容器类型:vector.deque.list.forward_list.string.array. queue(单向队列)底层也是用deque(双端队列)实现的 a.swap(b); swap(a ...
- c++ string 之 find_first_not_of 源码
一:实现之前先说一所find_first_not_of姊妹函数() (1)find_first_of(string &str, size_type index = 0):(find_first ...
- string类find_first_not_of ()方法
string类find_first_not_of ()方法 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://xfqxj.blog. ...
- 标准C++中的string类的用法总结
标准C++中的string类的用法总结 相信使用过MFC编程的朋友对CString这个类的印象应该非常深刻吧?的确,MFC中的CString类使用起来真的非常的方便好用.但是如果离开了MFC框架,还有 ...
随机推荐
- spark基础概念(一):幂等性。
1) 出处:幂等性源自数学概念,表示f(x) = f(f(x)); 含义:多次执行一个函数得到的值和执行一次得到的值相同. 如:f(x) = pow(x, 1); f(x) = abs(x); 2) ...
- JavaScript基础之数组常用方法
目录 JS 数组常用API 常用属性 常用方法 常见方法语法解释 from方法 isArray concat every fill filter find forEach indexOf join k ...
- shell一文入门通
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/hebtu666/article/deta ...
- python学习之数据类型(int,bool,str)
第三章 数据类型 3.1 Python基本数据类型 类型 含义 描述 int 整数 主要用来进⾏数学运算 str 字符串 可以保存少量数据并进⾏相应的操作 bool 布尔值 判断真假,True,Fal ...
- AI测试——旅程的终点
在2019年6月,我产生了一个想法,即人工智能探索测试AIET(Artificial intelligence exploration test),大概用了一周时间来思考怎么把人工智能应用到测试领域, ...
- python基础之编码
ascci:字母.数字.特色字符,1个字节-8位Unicode:两个字节-16位,升级版四个字节-32位uft-8:最少一个字节-8位,英文字母-1个字节-8位,欧洲-2个字节-16位,中文-3个字节 ...
- VC/MFC中的CComboBox控件使用详解
CComboBox控件详解 CComboBox控件又称作组合框控件,其有三种形态可供选择,1.简单组合框(Simple)2.下拉组合框(Drop-down)3.下拉列表式组合框(Drop-down l ...
- (5.6)mysql高可用系列——MySQL Utilities 管理工具
关键词:mysql工具集,mysql管理工具,mysql utilities [1]安装mysql utilities cd /download wget https://cdn.mysql.com/ ...
- Dango之模版系统
1.模板渲染 可以传列表,字典,对象等 {{ 变量 }} {% 逻辑 %} -- 标签 urls.py path('login/', views.login), views.py def login( ...
- Collection接口的子接口——Deque接口
https://docs.oracle.com/javase/8/docs/api/java/util/Deque.html public interface Deque<E> exten ...