Return to Snippet

Revision: 24865
at March 13, 2010 03:31 by abbey


Initial Code
package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var filename:String = "document.jpg";
        var extensionIndex:Number = filename.lastIndexOf( '.' );
        
        var extensionless:String = filename.substr( 0, extensionIndex ); 
        trace( "The filename is " + extensionless );


    }
  }
}

Initial URL
http://www.java2s.com/Code/Flash-Flex-ActionScript/String/UselastIndexOftogetthefilenamewithoutextensionname.htm

Initial Description

                                

Initial Title
AS3: Extract filename without the extension

Initial Tags
regex

Initial Language
ActionScript 3