I'm trying to write a string routine in C, and I keep hitting on the same issue.
In C, I have this string:
MAMAAMAAALJ
If I have this string:
AAA
How can I determine that AAA is inside of MAMAAMAAAJ?
Many C
runtime libraries contain the function strstr (const char *s1, const char *s2) .
If s2 is within s1, it returns a pointer within s1 to the beginning of the substring, otherwise returns NULL.
strstr("MAMAAMAAAJ", "AAA");
返回指向搜索字符串出现的指针,如果未找到则返回NULL
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.