String.replace()

var words:String = "ActionSnippet.com is a website. ActionSnippet.com is a blog.";

// outputs: "ActionSnippet.com is a website. ActionSnippet.com is a blog.";
trace(words);

// the "/g" tells it to replace all instances of ActionSnippet.com
words = words.replace(/ActionSnippet.com/g, "SomeWebsite.com");

// outputs: SomeWebsite.com is a website. SomeWebsite.com is a blog.
trace(words);

Just a quick response to a student question.

Leave a Reply

Your email address will not be published. Required fields are marked *