[SOLVED] Need some help with strreplace
#4

Yes, I suggest to use this function:

pawn Код:
stock strreplace2(string[], const find[], const replace[], bool:ignorecase=false, count=cellmax, maxlength=sizeof(string))
{
    if(isnull(find) || isnull(string)) return 0;
    new matches;
    for(new idx, flen = strlen(find), rlen = strlen(replace), pos = strfind(string, find, ignorecase); pos != -1 && idx < maxlength && matches < count; pos = strfind(string, find, ignorecase, idx)) {
        strdel(string, pos, pos + flen);
        if(rlen) strins(string, replace, pos, maxlength);   // Crashy
        idx = pos + rlen;
        matches++;
    }
    return matches;
}
Reply


Messages In This Thread
[SOLVED] Need some help with strreplace - by [03]Garsino - 28.04.2010, 21:12
Re: Need some help with strreplace - by M4S7ERMIND - 28.04.2010, 21:54
Re: Need some help with strreplace - by [03]Garsino - 29.04.2010, 13:22
Re: [SOLVED] Need some help with strreplace - by bpeterson - 29.04.2010, 13:25

Forum Jump:


Users browsing this thread: 1 Guest(s)