比较长的字符串中,是否含有特定字符串_repeat

比较长的字符串中,是否含有特定字符串_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"); }