View difference between Paste ID: A7ycUCLL and 4hiAsQCS
SHOW: | | - or go back to the newest paste.
1
stock str_replace(_string[], _substr[])
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); //len2 is needed as strins uses sizeof which won't work for the 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);
8
	}
9
	return 1;
10
}