#include <iostream>
#include <string>

using namespace std;
int main()
{
string s1("abcdemyyngl");
string s2("mngf");
size_t n = s1.find_last_not_of(s2);
cout << n << endl;
n = s1.find_last_not_of(s2, 6); //在s2中查找s1位置6之前的每个字符
cout << n << endl;
const char *s3 = "ghijy";
cout << s1.find_last_not_of(s3, 6) << endl;
cout << s1.find_last_not_of(s3, 5, 4) << endl;在s3的前4个字符中查找s1位置5前的字符
cout << s1.find_last_not_of('l', 8) << endl;
cout << s1.find_last_not_of('l', 7) << endl;
cout << s1.find_last_not_of('l') << endl;
return 0;
}

string::find_last_not_of的更多相关文章

  1. 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 ...

  2. C++ string 类详解

    字符串是存储在内存的连续字节中的一系列字符.C++ 处理字符串的方式有两种,一种来自 C 语言,常被称为 C-风格字符串,另一种是基于 string 类库的字符串处理方式.C 风格字符串的处理可以参考 ...

  3. LeetCode 5:Given an input string, reverse the string word by word.

    problem: Given an input string, reverse the string word by word. For example: Given s = "the sk ...

  4. 关于string类中find函数的讲解

    以下所讲的所有的string查找函数,都有唯一的返回类型,那就是size_type,即一个无符号整数(按打印出来的算).若查找成功,返回按查找规则找到的第一个字符或子串的位置:若查找失败,返回npos ...

  5. C++ string类型小结

    目录 构造函数 string.append() string.assign() string.at() string.back() string.begin() string.capasity() s ...

  6. STL顺序容器用法自我总结

    顺序容器类型:vector.deque.list.forward_list.string.array. queue(单向队列)底层也是用deque(双端队列)实现的 a.swap(b); swap(a ...

  7. 标准C++中的string类的用法总结

    标准C++中的string类的用法总结 相信使用过MFC编程的朋友对CString这个类的印象应该非常深刻吧?的确,MFC中的CString类使用起来真的非常的方便好用.但是如果离开了MFC框架,还有 ...

  8. c++:string函数

    string类的构造函数:string(const char *s);    //用c字符串s初始化string(int n,char c);     //用n个字符c初始化此外,string类还支持 ...

  9. string find

    string类的查找函数: ) const;//从pos开始查找字符c在当前字符串的位置 ) const;//从pos开始查找字符串s在当前串中的位置 int find(const char *s, ...

随机推荐

  1. Asp.Net Core 反向工程

    反向工程1.反向工程是实体类型类和一个基于数据库架构的 DbContext 类的基架的过程2.Scaffold-DbContext(数据库上下文脚手架)    使用Scaffold-DbContext ...

  2. app测试自动化操作方法之一

    1.在输入框里输入字符 dr.find_element_by_android_uiautomator\ ( 'new UiSelector().text("邮箱或手机号")').s ...

  3. PHP-T

    TP5目录结构 ├─application 应用目录 ├─extend 扩展类库目录(可定义) ├─public 网站对外访问目录 ├─runtime 运行时目录(可定义) ├─vendor 第三方类 ...

  4. socket之UDP协议,并发编程介绍,操作系统发展史

    socket之UDP协议 1.UDP协议 UDP 是User Datagram Protocol的简称, 中文名是用户数据报协议,是OSI(Open System Interconnection 参考 ...

  5. __setattr__,__getattr__,__delattr__

    class Foo: x = 1 def __init__(self,y): self.y = y def __getattr__(self,item): print("---->fr ...

  6. PTA(Basic Level)1023.组个最小数

    给定数字 0-9 各若干个.你可以以任意顺序排列这些数字,但必须全部使用.目标是使得最后得到的数尽可能小(注意 0 不能做首位).例如:给定两个 0,两个 1,三个 5,一个 8,我们得到的最小的数就 ...

  7. 设置mysql 5.7 可以外部访问的办法

    这里记录一下. 一台服务器上面的mysql出现了 无法外面连的情况解决办法: . 先尝试在宿主机上面登录 mysql -uroot -p 输入密码,可以登录. 然后 use mysql # 切换数据库 ...

  8. java_实现一个类只能声明一个对象

    public class StaticDemo { public int a=10; private static StaticDemo s= new StaticDemo(); private St ...

  9. Vue的快速入门

    1 环境准备 1 下载安装Node 地址https://nodejs.org/en/download/ 完成后通过cmd打开控制台输入node -v 可以看到版本信息 2 通过该node自带的npm ...

  10. 第一次编译ffmpeg

    今天开始玩ffmpeg了. 从官网下载来的压缩包,不会编译诶,于是我开始研究起来了. 下面就是实时记录的随笔: 首先是从官网下载来的ffmpeg,就是下面这个版本,目前的最新版吧. http://ff ...