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框架,还有 ...
随机推荐
- 【D3D12学习手记】The Command Queue and Command Lists
GPU有一个命令队列,CPU通过Direct3D API将命令提交到队列里来使用命令列表(command lists),如下图.当一套命令(a set of commands)已经被提交到命令队列,他 ...
- 【Linux】【三】linux 复制文件到指定目录
将 application/file/test/logs/ 下的文件 logs.log , logs.tar 复制到 application/file/test/tools/ 下,并新建文件夹[l ...
- React 克隆组件 -- React.cloneElement(可以用来修改子组件属性值,复制子组件,添加子组件)
项目要求实现按钮级权限,简单来说就是需要通过后台数据绑定来控制前端页面哪些操作按钮需要渲染,哪些操作按钮不需要渲染, 大体的方案是: 在原有的按钮标签外再套一层按钮权限控制标签,然后每个具体的按钮对照 ...
- springboot mybatis 下使用注解组织查询语句(有查询条件传入)
@Select("<script>" + "select cab.brandpre_id,cab.brandpre_num_app,cab.id,cab.br ...
- app测试自动化操作方法之二
3.进行APP的滑动操作 方法一:#获取窗口大小def get_size(): size=dr.get_window_size() return size print(get_size())#向上滑动 ...
- Eclipse新建新的工作空间,将原有的配置全部或部分复制
1.部分复制 File->Switch workspace->Other...,按下图选择 只复制简单的配置,如cvs之类的信息是不会复制的. 2.全部复制(build path) 在1. ...
- java初学者编译简单的计算机
package com.yj.test; import java.awt.BorderLayout; import java.awt.Font; import java.awt.GridLayout; ...
- layer ajax请求
layer ajax请求 $.ajax({ // url: '../php/creatSceneXml.php', url: '../php/action.php', type: 'POST', da ...
- thinkphp5.1 关于加载静态资源路径问题
和thinkphp5.0不一样,thinkphp5.1的 thinkphp5.0的 直接在config.php文件中加入代码: <?phpreturn [ 'view_replace_str' ...
- python实现更换电脑桌面壁纸,锁屏,文件加密方式
python实现更换壁纸和锁屏代码 #控制windows系统 import win32api,win32con,win32gui # 可以利用python去调用dll动态库的包.嵌入式开发 from ...