View difference between Paste ID: kZ3NPUmz and rupdgn7Z
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, false, lastreplace); (x!= -1  && x > lastreplace) ; x = strfind(_string, _substr, false, lastreplace))
5
	{
6
		strdel(_string, x, x+_len);
7
		strins(_string, _substr_rp, x);
8
		lastreplace = x;
9
	}
10
	return 1;
11
}