Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] parse question


  • From: jonathan.buchanan at gmail.com (Jonathan Buchanan)
  • Subject: [Javascript] parse question
  • Date: Sun Feb 25 15:04:01 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.