Implement strpbrk(), add strpbrk test

This commit is contained in:
Andrii Zymohliad
2018-03-12 18:01:12 +08:00
parent a1de0ef8a1
commit 1e969afd43
5 changed files with 34 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
#include <string.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
char* str = "The quick drawn fix jumps over the lazy bug";
// should be "The quick drawn fix jumps over the lazy bug"
char* str1 = strpbrk(str, "From The Very Beginning");
printf("%s\n", (str1) ? str1 : "NULL");
// should be "lazy bug"
char* str2 = strpbrk(str, "lzbg");
printf("%s\n", (str2) ? str2 : "NULL");
// should be "NULL"
char* str3 = strpbrk(str, "404");
printf("%s\n", (str3) ? str3 : "NULL");
return 0;
}