Advertisement
Hiddos

strreplace

May 2nd, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.30 KB | None | 0 0
  1. stock strreplace(str[], const find[], const rep[])
  2. {
  3.     new strpos, findlen = strlen(find), replen = strlen(rep);
  4.    
  5.     LOOP:
  6.     strpos = strfind(str, find, false, strpos);
  7.     if(strpos == -1) goto ENDLOOP;
  8.     strdel(str, strpos, strpos + findlen);
  9.     strins(str, rep, strpos, replen);
  10.     goto LOOP;
  11.     ENDLOOP:
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement