Implement strcasestr

This commit is contained in:
jD91mZM2
2018-10-06 17:37:50 +02:00
parent 9d56ce42c6
commit 26d629674a
3 changed files with 29 additions and 23 deletions
+5 -11
View File
@@ -2,17 +2,11 @@
#include <stdio.h>
int main(int argc, char* argv[]) {
// should be "rust"
char* res1 = strstr("In relibc we trust", "rust");
printf("%s\n", (res1) ? res1 : "NULL");
// should be "libc we trust"
char* res2 = strstr("In relibc we trust", "libc");
printf("%s\n", (res2) ? res2 : "NULL");
// should be "NULL"
char* res3 = strstr("In relibc we trust", "bugs");
printf("%s\n", (res3) ? res3 : "NULL");
printf("%s\n", strstr("In relibc we trust", "rust"));
printf("%s\n", strstr("In relibc we trust", "libc"));
printf("%s\n", strstr("In relibc we trust", "bugs"));
printf("%s\n", strstr("IN RELIBC WE TRUST", "rust"));
printf("%s\n", strcasestr("IN RELIBC WE TRUST", "rust"));
return 0;
}