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

Download zip

4 Responses to “AS3 Find and Replace static class”

  1. adam says:

    Terry! at 9.49pm i googled ‘as3 find and replace’, and this was hit number 3
    Perfect timing! hahaha

  2. adam says:

    10/10 because it works and because mua loves you for it

  3. Joey says:

    Wahooo!!! Thank you so much for that one! Exactly what I needed!

  4. Carlo says:

    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*”);

Leave a Reply