=========================strstr个人实现============================= char *Strstr(char *strSrc, const char *strDes) { int i, j; int lenSrc = 0, lenDes = 0; const char *pSrc = strSrc, *pDes = strDes; if ( strSrc == NULL || strDes == NULL ) return NULL; while ( *pSrc++ ) lenSrc++; while ( *pDes++ ) lenDes++; i = j = 0; while ( i < lenSrc && j < lenDes ) { if ( strSrc[ i ] == strDes[ j ] ) { i++; j++; } else { i = i - j + 1; j = 0; } } if ( j >= lenDes ) return &strSrc[ i - j ]; return NULL; }