View difference between Paste ID: rupdgn7Z and h6r6pqbJ
SHOW: | | - or go back to the newest paste.
1
stock str_replace(_string[], _substr[], _substr_rp[])
2
{
3
	new _len = strlen(_substr), _len2 = strlen(_string), lastreplace;
4-
	for(new x = strfind(_string, _substr); (x!= -1  || x > lastreplace) ; x = strfind(_string, _substr))
4+
	for(new x = strfind(_string, _substr); (x!= -1  && x > lastreplace) ; x = strfind(_string, _substr))
5
	{
6
		strdel(_string, x, x+_len);
7
		strins(_string, _substr_rp, x);
8
		lastreplace = x;
9
	}
10
	return 1;
11
}