![]() |
url manipulation - extract final /folder/ only from u
How does one extract the the final /folder/ name in a URL string of unknown
length and folder division which may come in in slightly different (albeit identical results) as in the following: For instance: http://www.catamarans.com/charter/ba...peed/index.asp www.catamarans.com/charter/bareboat/oceanspeed/ http://www.catamarans.com/charter/ba...eanspeed/?m=SM I would wish to only get back: "oceanspeed" I would appeciate code examples on this. Many thanks. Jason |
Re: url manipulation - extract final /folder/ only from u
sURL = Request.ServerVariables("URL")
aParts = Split(sURL, "/") sFinalDir = aParts(UBound(aParts)-1) I think that should work. Ray at work "jason" <jason@catamaranco.com> wrote in message news:Oiex3zovDHA.2444@TK2MSFTNGP12.phx.gbl... > How does one extract the the final /folder/ name in a URL string of unknown > length and folder division which may come in in slightly different (albeit > identical results) as in the following: > > For instance: > > http://www.catamarans.com/charter/ba...peed/index.asp > www.catamarans.com/charter/bareboat/oceanspeed/ > http://www.catamarans.com/charter/ba...eanspeed/?m=SM > > I would wish to only get back: > > "oceanspeed" > > I would appeciate code examples on this. Many thanks. > > Jason > > > > |
Re: url manipulation - extract final /folder/ only from u
Allright! That works beautifully - I'll get a lot of mileage of that
script....many thanks - helps me a lot! Cheers Jason "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:ejhMt4ovDHA.2308@TK2MSFTNGP11.phx.gbl... > sURL = Request.ServerVariables("URL") > aParts = Split(sURL, "/") > sFinalDir = aParts(UBound(aParts)-1) > > I think that should work. > > Ray at work > > > "jason" <jason@catamaranco.com> wrote in message > news:Oiex3zovDHA.2444@TK2MSFTNGP12.phx.gbl... > > How does one extract the the final /folder/ name in a URL string of > unknown > > length and folder division which may come in in slightly different (albeit > > identical results) as in the following: > > > > For instance: > > > > http://www.catamarans.com/charter/ba...peed/index.asp > > www.catamarans.com/charter/bareboat/oceanspeed/ > > http://www.catamarans.com/charter/ba...eanspeed/?m=SM > > > > I would wish to only get back: > > > > "oceanspeed" > > > > I would appeciate code examples on this. Many thanks. > > > > Jason > > > > > > > > > > |
| All times are GMT. The time now is 12:05 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.