469,336 Members | 5,552 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

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


Jul 19 '05 #1
2 3025
sURL = Request.ServerVariables("URL")
aParts = Split(sURL, "/")
sFinalDir = aParts(UBound(aParts)-1)

I think that should work.

Ray at work
"jason" <ja***@catamaranco.com> wrote in message
news:Oi**************@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

Jul 19 '05 #2
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:ej**************@TK2MSFTNGP11.phx.gbl...
sURL = Request.ServerVariables("URL")
aParts = Split(sURL, "/")
sFinalDir = aParts(UBound(aParts)-1)

I think that should work.

Ray at work
"jason" <ja***@catamaranco.com> wrote in message
news:Oi**************@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


Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by yerk5 | last post: by
6 posts views Thread by Mohammad-Reza | last post: by
5 posts views Thread by Cleverbum | last post: by
4 posts views Thread by Eugene Anthony | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.