标签:style blog color io 2014 re
1、字符串包含程序
#include<stdio.h> #include<string.h> int Strstr(char *String, char *Substring) { if(String==NULL||Substring==NULL||strlen(String)<strlen(Substring)) return -1; char *pString=String; char *pSubstring=Substring; int count=0; while(*pString!=‘\0‘) { pSubstring=Substring; while(*pSubstring==*pString) { pString++; pSubstring++; if(*pSubstring==‘\0‘) return count; } pString++; count++; } } void main() { char Str[]="ABCD"; char Substr[]="ABCDEEE"; int index=Strstr(Str,Substr); printf("%d",index); }
20140723 字符串包含程序,布布扣,bubuko.com
标签:style blog color io 2014 re
原文地址:http://www.cnblogs.com/yexuannan/p/3863350.html