字符串
文章平均质量分 55
桃花仙人~
这个作者很懒,什么都没留下…
展开
-
C++string中文的匹配问题
问题引入正常字符串匹配,全英文string str = "abc";if ((int)str.find("bc") > 0) printf("okay\n"); // 匹配成功else printf("none\n"); // 匹配失败// 输出 okay如果其中包含中文string str = "人类";if ((int)str.find("死") > 0) printf("okay\n"); // 匹配成功else printf("none原创 2021-09-16 19:22:59 · 3094 阅读 · 2 评论 -
字符串的查找的3种方法
字符串的查找的几种方法KMPstrstr()find()KMP#include <iostream>#include <cstring>#include <algorithm>using namespace std;const int N = 1e5 + 10, M = 1e6 + 10;char s[M],p[N];int ne[M];int main(){ int n,m; cin>>n>>p +原创 2021-04-21 20:05:17 · 2371 阅读 · 0 评论