Use the lastIndexOf method to get the file extension name : IndexOf lastIndexOf : String Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » String » IndexOf lastIndexOf »

 

Use the lastIndexOf method to get the file extension name


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var filename:String = "document.jpg";
        var extensionIndex:Number = filename.lastIndexOf'.' );
        
        var extension:String = filename.substrextensionIndex + 1, filename.length );
        trace"The file extension is " + extension );

    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo String
» IndexOf lastIndexOf