#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. spark基础概念(一):幂等性。

    1) 出处:幂等性源自数学概念,表示f(x) = f(f(x)); 含义:多次执行一个函数得到的值和执行一次得到的值相同. 如:f(x) = pow(x, 1);  f(x) = abs(x); 2) ...

  2. Sqlserver实现故障转移 — sqlserver镜像备份实现故障转移(3)

    目的:在已经加域的计算机上安装sqlserver2012,并配置数据库镜像实时同步,并实现故障转移. 在数据库层面实现故障自动转移后,应用程序里改怎么写数据库连接呢?其实使用ADO.NET或者SQL ...

  3. httpClient 进行get请求

    String url = baseUrl; logger.info("checkIfTheFolderIsExist"); CloseableHttpClient httpClie ...

  4. webdriervAPI(By声明定位方法)

    from  selenium  import  webdriver from  selenium.webdriver.common.by  import  By 导入By方法 driver  =  w ...

  5. 【Python开发】增强的格式化字符串format函数

    自python2.6开始,新增了一种格式化字符串的函数str.format(),可谓威力十足.那么,他跟之前的%型格式化字符串相比,有什么优越的存在呢?让我们来揭开它羞答答的面纱. 语法 它通过{}和 ...

  6. [转] Python中的装饰器(decorator)

    想理解Python的decorator首先要知道在Python中函数也是一个对象,所以你可以 将函数复制给变量 将函数当做参数 返回一个函数 函数在Python中和变量的用法一样也是一等公民,也就是高 ...

  7. 【2019V2全新发布】ComponentOne .NET开发控件集,新增.NET Core数据引擎

    ComponentOne .NET开发控件集 2019V2正式发布,除持续完善并加入全新的.NET开发控件外,还针对产品架构稳定性.易用性.与.NET Core平台深度集成.已有控件功能增强等多个方面 ...

  8. Entity Framework常用方法及案例

    ⒈Skip(int count) 说明:跳过集合的前n个元素:延迟.即我们跳过给定的数目返回后面的结果集. ⒉Take(int count) 说明:获取集合的前n个元素:延迟.即只返回限定数量的结果集 ...

  9. 有关最短路上的第k小/大值的总结

    1.USACO08JAN  Telephone Lines 题面 由于问的是最大值最小,所以二分加验证就好了 比较显然的,题干问的是第k+1长的路最短: 那么二分答案是正确的方向: 但是怎么验证? 我 ...

  10. centos7 上pip install mysqlclient的时候报错OSError: mysql_config not found,

    yum install mysql-devel gcc gcc-devel python-devel