Posted By

abbey on 03/13/10


Tagged

regex filename extract


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Tex
donaldleegraham
tspitzr


AS3: Extract filename without the extension


 / Published in: ActionScript 3
 

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

  1. package{
  2. import flash.display.Sprite;
  3.  
  4. public class Main extends Sprite{
  5. public function Main(){
  6.  
  7. var filename:String = "document.jpg";
  8. var extensionIndex:Number = filename.lastIndexOf( '.' );
  9.  
  10. var extensionless:String = filename.substr( 0, extensionIndex );
  11. trace( "The filename is " + extensionless );
  12.  
  13.  
  14. }
  15. }
  16. }

Report this snippet  

You need to login to post a comment.