Actionscript string replace

Search and replace is a very useful thing to have. Actionscript dosent have a built-in function for this purpose. This is very simple function which can do the above thing.

Source code for webtoolkit.strreplace.as

/**
*
*  Actionscript string replace
*  http://www.webtoolkit.info/
*
**/
 
function str_replace(haystack, needle, replacement) {
	temp = haystack.split(needle);
	return temp.join(replacement);
}