string::npos 学习

https://blog.csdn.net/qq_33933704/article/details/79188028

1.基本用法

利用find函数完成对字符串的查找操作。

注意:

查找字符串a是否包含子串b,不是用strA.find(strB) > 0 而是 strA.find(strB) != string::npos

其中string::npos是个特殊值,说明查找没有匹配。

int main(){
    cout<<string::npos;
    return 0;
}

#输出:
18446744073709551615

查看它的数据类型:

#include <typeinfo>
using namespace std;
int main(){
    cout<<typeid(string::npos).name();
    return 0;
}

#输出
y

输出y是什么意思???

2.类型

 https://blog.csdn.net/devil_pull/article/details/25478525

是size_t类型的变量,表示size_t的最大值?

posted @ 2020-12-27 18:36  lypbendlf  阅读(249)  评论(0编辑  收藏  举报