c++新特性
在
string
里面使用find
函数查找子串1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int main() {
std::string a="this";
std::string b="this is b";
const auto tem= a<=>b;
auto i=b.find(a);
if(i!=std::string::npos){
for (int j = i; j < i+a.size(); ++j) {
std::cout<<b[j];
}
std::cout<<std::endl<<"^"<<i;
}
return 0;
}
c++新特性
https://tsy244.github.io/2023/06/26/cpp/cpp新特性/