Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > url manipulation - extract final /folder/ only from u

Reply
Thread Tools

url manipulation - extract final /folder/ only from u

 
 
jason
Guest
Posts: n/a
 
      12-09-2003
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




 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      12-09-2003
sURL = Request.ServerVariables("URL")
aParts = Split(sURL, "/")
sFinalDir = aParts(UBound(aParts)-1)

I think that should work.

Ray at work


"jason" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>
>
>



 
Reply With Quote
 
 
 
 
jason
Guest
Posts: n/a
 
      12-09-2003
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:(E-Mail Removed)...
> sURL = Request.ServerVariables("URL")
> aParts = Split(sURL, "/")
> sFinalDir = aParts(UBound(aParts)-1)
>
> I think that should work.
>
> Ray at work
>
>
> "jason" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting final url when original url redirects IanR Python 2 03-12-2009 08:50 PM
Word open as Final, not Final Showing Markup Karl Engel Computer Support 4 12-19-2006 04:20 AM
Non-final class at compile-time, final at runtime pietdejong@gmail.com Java 5 11-17-2006 12:30 PM
Difference between static final members and final static members(if any)? JFCM Java 4 02-07-2006 11:32 AM
Is there a class or method to construct url args or extract url args? Ken Varn ASP .Net 2 06-22-2005 12:26 PM



Advertisments