标签:
const char* strstr(const char *str, const char* substr) { int i, j, temp; for (i = 0; str[i] != ‘\0‘; i++) { j = 0; temp = i; //记录当前主字符串位置 while (str[i++]==substr[j++]) { if (substr[j] == ‘\0‘) { return &str[temp]; } else if (str[i]==‘\0‘) { return NULL; } } } return NULL; }
//有待做具体测试
标签:
原文地址:http://www.cnblogs.com/jason1990/p/4659425.html