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则不同;

  • 相关阅读:
    全志A10_linux3.0内核编译记录
    C#使用Socket登陆WordPress源码
    UIKeyboardType键盘
    浅谈 iOS 版本号
    学习软件开发应该看的书
    NSPredicate的用法
    ios 技巧总结(不断更新)
    RSA 加解密
    GCD下的几种实现同步的方式
    iOS事件处理
  • 原文地址:https://www.cnblogs.com/sunbines/p/14457055.html
Copyright © 2011-2022 走看看