string类find_first_not_of ()方法
2024-09-05 10:27:26
string类find_first_not_of ()方法 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://xfqxj.blog.51cto.com/2342497/512015
#include <string> #include <iostream>
using namespace std; int main()
{
string strFirst ( "abced" ),strSecond("abc abc abd def");
cout<<strFirst.find("a")<<endl;//输出结果为0,说明a当前的索引位置为0 //函数原型:size_type find_first_not_of( Char ch, size_type index = 0 ) const;
//返回在字符串中首次不匹配 d 的首字符索引,从2开始。
cout<<strFirst.find_first_not_of ( "d" ,)<<endl;//输出结果为 2 cout<<strSecond.length()<<endl;//输出结果为15
cout<<strSecond.find_first_not_of("abc",)<<endl;//输出结果为7
system("pause");
}
最新文章
- 【linux草鞋应用编程系列】_1_ 开篇_系统调用IO接口与标准IO接口
- select for update行锁
- LINQ的Union方法
- 【BZOJ-4562】食物链 记忆化搜索(拓扑序 + DP)
- js判空
- 强制JSP页面刷新,防止被服务器缓存(可用于静态include强制刷新)
- BZOJ 1003 物流运输
- Could not load file or assembly &#39;MagickNet.dll&#39;
- powerdesigner连接数据库 导出数据 生成PDM文件 傻瓜试教程
- vb delphi7、2010 csharp vb.net空白测试程序
- Spring Autowire自动装配
- JQuery EasyUi 扩展combox验证
- queue C++
- Codeforces543BDestory Roads心得
- [UE4]Drop,扔物品
- TP5中的小知识
- canvas 动画 时钟clock
- Spring工作原理与单例
- EF三种加载方法
- phalcon的CLI应用