zoukankan      html  css  js  c++  java
  • 【顺序容器 || 09】

    string搜索操作

    1. find函数简介

    size_t find ( const string& str, size_t pos = 0 ) const;
    size_t find ( const char* s, size_t pos, size_t n ) const;
    size_t find ( const char* s, size_t pos = 0 ) const;
    size_t find ( char c, size_t pos = 0 ) const;

     2. find_first_of函数简介

    size_t find_first_of ( const string& str, size_t pos = 0 ) const;
    size_t find_first_of ( const char* s, size_t pos, size_t n ) const;
    size_t find_first_of ( const char* s, size_t pos = 0 ) const;
    size_t find_first_of ( char c, size_t pos = 0 ) const;

    函数原型:

    size_t find_first_of ( const string& str, size_t pos = 0 ) const;
    size_t find_first_of ( const char* s, size_t pos, size_t n ) const;
    size_t find_first_of ( const char* s, size_t pos = 0 ) const;
    size_t find_first_of ( char c, size_t pos = 0 ) const;

    参数和find基本相同,不在赘述!

    特别注意:

    find_first_of 函数最容易出错的地方是和find函数搞混。它最大的区别就是如果在一个字符串str1中查找另一个字符串str2,如果str1中含有str2中的任何字符,则就会查找成功,而find则不同;

  • 相关阅读:
    Centos下安装部署redis
    mysql 事务操作
    python 基础杂货铺
    6、Django 第三方工具
    5、Django
    4、django 模板
    RPC框架--missian框架
    jvm详情——7、jvm调优基本配置、方案
    jvm详情——6、堆大小设置简单说明
    jvm详情——5、选择合适的垃圾收集算法
  • 原文地址:https://www.cnblogs.com/sunbines/p/14457055.html
Copyright © 2011-2022 走看看