比较长的字符串中,是否含有特定字符串_repeat
📅 2026/7/12 20:37:13
👁️ 阅读次数
📝 编程学习
比较长的字符串中,是否含有特定字符串_repeat
#include <string.h> const char *long_str = "This is a very long string containing some keywords"; const char *needle = "keywords"; if (strstr(long_str, needle) != NULL) { // 存在 "keywords"字符串 printf("found it\n"); } else { // 不存在 "keywords"字符串 printf("not found\n"); }
编程学习
技术分享
实战经验