Posted By

adrianparr on 03/16/10


Tagged

url filename extension as3 lastindexof


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

socialflasher
alptugan
tspitzr
deers


AS3 Get a File Extension from a URL or Filename


 / Published in: ActionScript 3
 

  1. function getExtension($url:String):String
  2. {
  3. var extension:String = $url.substring($url.lastIndexOf(".")+1, $url.length);
  4. return extension;
  5. }
  6.  
  7. trace(getExtension("my_filename.jpg"));
  8. // OUTPUT: jpg

Report this snippet  

You need to login to post a comment.