ぼるじょあがC/C++の宿題を片づけますYO! 42代目
■ このスレッドは過去ログ倉庫に格納されています
0211デフォルトの名無しさん
2005/04/21(木) 12:06:56void replaceString(char* string, const char* from, const char* to)
{
const int len1 = (int)strlen(from);
const int len2 = (int)strlen(to);
char* found = strstr(string, from);
while (found) {
if (len1 != len2) {
memmove(found + len2, found + len1, strlen(found + len1) + 1);
}
memcpy(found, to, len2);
found = strstr(found + len2, from);
}
}
■ このスレッドは過去ログ倉庫に格納されています