Use replace with while loop : Replace : String Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » String » Replace »

 

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" != -) {
          replaced = replaced.replace"it's""it is" );
        }
        
        replaced = replaced.replace"It's""It is" );
        
        tracereplaced );
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo String
» Replace