[Javascript] parse question

Jonathan Buchanan jonathan.buchanan at gmail.com
Sun Feb 25 15:03:47 CST 2007


tedd wrote:
> Hi gang:
> 
> I've reviewed several methods to parse strings, but what's the 
> shortest/easiest method to parse the sting from:
> 
> http://www.mydomain.com/firstdir/secondir/myfile.txt
> 
> to:
> 
> myfile.txt   ?

One possible method:

var s = "http://www.mydomain.com/firstdir/secondir/myfile.txt";
s.split("/").pop();

Jonathan.



More information about the Javascript mailing list