Use replace with while loop
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var example:String = "It's a bird, it's a plane, it's ActionScript Man!";
var replaced:String = example; // Initialize replaced with the original text
while ( replaced.indexOf( "it's" ) != -1 ) {
replaced = replaced.replace( "it's", "it is" );
}
replaced = replaced.replace( "It's", "It is" );
trace( replaced );
}
}
}
Related examples in the same category