int CompareString(string sDest, string str)
{
int nCount = 0;
for (int i = 0; i < strlen(sDest.c_str()); i++)
{
for (int j = 0; j < str.length(); j++)
{
if (sDest.at(i+j) == str.at(j))
{
nCount++;
if (nCount == str.length())
{
return i;
}
}
else
{
nCount = 0;
break;
}
}
}
return -1;
}
找到最大的子串
猜你喜欢
转载自blog.csdn.net/qq_16628589/article/details/89352199
今日推荐
周排行