小弟想请教各位有什么高招
DWORD timesInStr(CString str1,CString str2)
{
DWORD dwReturn;
///////////////////////////////////
//add code here...
return dwReturn;
}
DWORD timesInStr(CString str1,CString str2)
{
DWORD dwReturn;
///////////////////////////////////
//add code here...
return dwReturn;
}
{
DWORD dwReturn = 0;
///////////////////////////////////
//add code here...
while(str1.Find(str2))
{
dwReturn++;
str1.Delete(str1.Find(str2), str2.GetLenth());
}
return dwReturn;
}
{
DWORD dwReturn = 0;
///////////////////////////////////
//add code here...
while(str1.Find(str2))
{
dwReturn++;
str1.Delete(str1.Find(str2), str2.GetLenth());
}
return dwReturn;
}
Find 就效率很低,而 Delete 的效率更低!
str1(需要在其中查找的)比较大