Replacer
#2

strreplace()

pawn Код:
stock strreplace(trg[],newstr[],src[])
{
  new f=0;
  new s1[MAX_STRING];
  new tmp[MAX_STRING];
  format(s1,sizeof(s1),"%s",src);
  f = strfind(s1,trg);
  tmp[0]=0;
  while (f>=0)
  {
    strcat(tmp,ret_memcpy(s1, 0, f));
    strcat(tmp,newstr);
    format(s1,sizeof(s1),"%s",ret_memcpy(s1, f+strlen(trg), strlen(s1)-f));
    f = strfind(s1,trg);
  }
  strcat(tmp,s1);
  return tmp;
}
Reply


Messages In This Thread
Replacer - by Mechscape - 13.04.2010, 21:01
Re: Replacer - by Mikep. - 13.04.2010, 21:06
Re: Replacer - by Mechscape - 13.04.2010, 21:08
Re: Replacer - by Mikep. - 13.04.2010, 21:13

Forum Jump:


Users browsing this thread: 1 Guest(s)