Simple Find and Replace Function

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

This is a simple but effective function allows you to search a string and replace characters

function searchAndReplace(holder:String, searchfor:String, replacement:String) {
		var temparray:Array = new Array();
		temparray = holder.split(searchfor);
		holder = temparray.join(replacement);
		return (holder);
	}


One Response to “Simple Find and Replace Function”

  1. Imran Khan says:

    its not workig.
    I try to use this code in my AS 2 and its not working.

    Its compiled with no error but no results.

Leave a Reply

Close
E-mail It