View difference between Paste ID: ywEMLnz7 and A7ycUCLL
SHOW: | | - or go back to the newest paste.
1-
stock str_replace(_string[], _substr[])
1+
stock str_replace(_string[], _substr[], _substr_rp[])
2
{
3-
	new _len = strlen(_substr), _len2 = strlen(_string); //len2 is needed as strins uses sizeof which won't work for the string.
3+
	new _len = strlen(_substr), _len2 = strlen(_string);
4
	for(new x = strfind(_string, _substr); x!= -1; x = strfind(_string, _substr))
5
	{
6
		strdel(_string, x, x+_len);
7-
		strins(_string, _substr, x);
7+
		strins(_string, _substr_rp, x);
8
	}
9
	return 1;
10
}