zoukankan      html  css  js  c++  java
  • string类find_first_not_of ()方法

     1 string类find_first_not_of ()方法
     2 
     3 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://xfqxj.blog.51cto.com/2342497/512015
     4 #include <string>
     5 
     6 #include <iostream>
     7 using namespace std;
     8  
     9 int main()
    10 {
    11 string strFirst ( "abced" ),strSecond("abc abc abd def");
    12 cout<<strFirst.find("a")<<endl;//输出结果为0,说明a当前的索引位置为0
    13  
    14 //函数原型:size_type find_first_not_of( Char ch, size_type index = 0 ) const;
    15 //返回在字符串中首次不匹配 d 的首字符索引,从2开始。
    16 cout<<strFirst.find_first_not_of ( "d" ,2)<<endl;//输出结果为 2
    17  
    18 cout<<strSecond.length()<<endl;//输出结果为15
    19 cout<<strSecond.find_first_not_of("abc",4)<<endl;//输出结果为7
    20 system("pause");
    21 }
    View Code
  • 相关阅读:
    Linux strip
    有趣的BUG
    GDB watch std::string size
    Redis Cluster Lua
    Double Buffer
    Yarn架构
    天池公交客流预测比赛
    hashmap,ConcurrentHashMap与hashtable的区别
    fail-fast和fail-safe
    常见机器学习算法优缺点
  • 原文地址:https://www.cnblogs.com/herizai/p/3145126.html
Copyright © 2011-2022 走看看