AS3 Find and Replace static class (4)
January 16th, 2009 by terrypaton, under Library.
Pass it a string, a search string, and a replacement string and it will return a new string! (did that even make sense?).
This example uses the following code …
import FindReplace;
var originalString:String=”This is the sentence I want to have words was letters found was then replaced was where”;
var resultString:String=FindReplace.FindReplaceText(originalString,”was”,”*WAS*”);
textBox1.text = originalString
textBox2.text = resultString






Terry! at 9.49pm i googled ‘as3 find and replace’, and this was hit number 3
Perfect timing! hahaha
10/10 because it works and because mua loves you for it
Wahooo!!! Thank you so much for that one! Exactly what I needed!
Neat class, but wouldn’t it be much simpler to do this:
var originalString:String=”This is the sentence I want to have words was letters found was then replaced was where”;
var resultString:String = originalString.split(“was”).join(“*W A S*”);