进程 中的 int find_last_not_of(strin

首页 / C++入门教程 / 进程 中的 int find_last_not_of(strin

此函数用于在字符串中搜索与字符串中指定的任何字符都不匹配的最后一个字符。

find_last_not_of - 语法

考虑两个字符串str1和str2。其语法为:

str1.find_last_not_of(str2);

find_last_not_of - 参数

str   -  str是用于搜索的字符串。

pos  -  它定义开始搜索的位置。

n       -  标识要搜索的字符的字符数。

ch     -  它定义了要搜索的字符。

find_last_not_of - 返回值

此函数返回不匹配的最后一个字符的位置。

find_last_not_of - 例子1

让我们看一个简单的例子。

    #include<iostream>
    using namespace std;
    int main()
    {
        string str = "C is a procedure oriented language";
        cout<< "String contains :" << str <<'\n';
        cout<< str.find_last_not_of("C is a structural language");
        return 0;
       }

输出:

String contains : C is a procedure oriented language
24

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

趣谈网络协议 -〔刘超〕

从0开始学大数据 -〔李智慧〕

微信小程序全栈开发实战 -〔李艺〕

技术管理案例课 -〔许健〕

高楼的性能工程实战课 -〔高楼〕

大数据经典论文解读 -〔徐文浩〕

Spring Cloud 微服务项目实战 -〔姚秋辰(姚半仙)〕

快手 · 音视频技术入门课 -〔刘歧〕

超级访谈:对话毕玄 -〔毕玄〕

好记忆不如烂笔头。留下您的足迹吧 :)