url manipulation - extract final /folder/ only from u

Discussion in 'ASP General' started by jason, Dec 9, 2003.

  1. jason

    jason Guest

    jason, Dec 9, 2003
    #1
    1. Advertisements

  2. jason

    Ray at Guest

    sURL = Request.ServerVariables("URL")
    aParts = Split(sURL, "/")
    sFinalDir = aParts(UBound(aParts)-1)

    I think that should work.

    Ray at work


    "jason" <> wrote in message
    news:...
    > 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:
    >
    > www.catamarans.com/charter/bareboat/oceanspeed/index.asp
    > www.catamarans.com/charter/bareboat/oceanspeed/
    > www.catamarans.com/charter/bareboat/oceanspeed/?m=SM
    >
    > I would wish to only get back:
    >
    > "oceanspeed"
    >
    > I would appeciate code examples on this. Many thanks.
    >
    > Jason
    >
    >
    >
    >
     
    Ray at, Dec 9, 2003
    #2
    1. Advertisements

  3. jason

    jason Guest

    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:...
    > sURL = Request.ServerVariables("URL")
    > aParts = Split(sURL, "/")
    > sFinalDir = aParts(UBound(aParts)-1)
    >
    > I think that should work.
    >
    > Ray at work
    >
    >
    > "jason" <> wrote in message
    > news:...
    > > 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:
    > >
    > > www.catamarans.com/charter/bareboat/oceanspeed/index.asp
    > > www.catamarans.com/charter/bareboat/oceanspeed/
    > > www.catamarans.com/charter/bareboat/oceanspeed/?m=SM
    > >
    > > I would wish to only get back:
    > >
    > > "oceanspeed"
    > >
    > > I would appeciate code examples on this. Many thanks.
    > >
    > > Jason
    > >
    > >
    > >
    > >

    >
    >
     
    jason, Dec 9, 2003
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon paugh
    Replies:
    1
    Views:
    1,357
  2. Ken Varn
    Replies:
    2
    Views:
    788
    Ken Varn
    Jun 22, 2005
  3. JFCM
    Replies:
    4
    Views:
    6,021
  4. keithb
    Replies:
    2
    Views:
    8,364
    keithb
    Jun 7, 2006
  5. Replies:
    5
    Views:
    742
    Chris Uppal
    Nov 17, 2006
  6. IanR
    Replies:
    2
    Views:
    453
    Albert Hopkins
    Mar 12, 2009
  7. Just D.
    Replies:
    0
    Views:
    815
    Just D.
    Aug 11, 2004
  8. jason
    Replies:
    9
    Views:
    237
    Ray at
    Dec 10, 2003
Loading...