How would I strip out everything from before the last "/" in the following
string generated from request.servervaraibles method:

http://www.essermanyachtsales.com/riverbend/

...so that I was just left with:

"Riverbend"

Many thanks

Jason

Re: String manipulation of a URL - strip preceding characters? by Aaron

Aaron
Wed Jul 23 10:13:20 CDT 2003

url = "http://www.essermanyachtsales.com/riverbend/"
url = split(url, "/"): response.write url(3)



"jason" <jason@catamaranco.com> wrote in message
news:OYASKvSUDHA.1724@TK2MSFTNGP10.phx.gbl...
> How would I strip out everything from before the last "/" in the following
> string generated from request.servervaraibles method:
>
> http://www.essermanyachtsales.com/riverbend/
>
> ...so that I was just left with:
>
> "Riverbend"
>
> Many thanks
>
> Jason
>
>
>



Re: String manipulation of a URL - strip preceding characters? by Bob

Bob
Wed Jul 23 10:19:28 CDT 2003

jason wrote:
> How would I strip out everything from before the last "/" in the
> following string generated from request.servervaraibles method:
>
> http://www.essermanyachtsales.com/riverbend/
>
> ...so that I was just left with:
>
> "Riverbend"
>
> Many thanks
>
> Jason
This particular string is easy:

dim str,ar
str="http://www.essermanyachtsales.com/riverbend/"
ar = split(str,"/")
response.write ar(ubound(ar))

However, who is to say that your string might not contain
"http://www.essermanyachtsales.com/riverbend/default.asp"?
Now, you would have to do this:
ar = split(str,"/")
response.write ar(ubound(ar)-1)

So, use If:

ar = split(str,"/")
if right(str,1) = "/" then
response.write ar(ubound(ar))
else
response.write ar(ubound(ar)-1)
end if

Of course, you have to check to make sure str contains any characters at all
...

HTH,
Bob Barrows



Re: String manipulation of a URL - strip preceding characters? by Bob

Bob
Wed Jul 23 10:43:08 CDT 2003

Aaron Bertrand - MVP wrote:
>> However, who is to say that your string might not contain
>> "http://www.essermanyachtsales.com/riverbend/default.asp"?
>> Now, you would have to do this:
>> ar = split(str,"/")
>> response.write ar(ubound(ar)-1)
>
> Except what if it is
> "http://www.essermanyachtsales.com/riverbend/subfolder/default.asp"?
>
> This is where using ar(3) would always get the base subfolder...

True - depends on what he wants. He DID say " ... everything from before the
last "/" ..."

Bob



Re: String manipulation of a URL - strip preceding characters? by Aaron

Aaron
Wed Jul 23 10:52:36 CDT 2003

> > This is where using ar(3) would always get the base subfolder...
>
> True - depends on what he wants. He DID say " ... everything from before
the
> last "/" ..."

Right, which is why I didn't say, "you should use ar(3) instead." :-)



Re: String manipulation of a URL - strip preceding characters? by jason

jason
Wed Jul 23 11:14:52 CDT 2003

I guess I should be specific that I cannot always know in advance how many
subfolders there will be after the url...BUT...I always need to know what is
the LAST subfolder and its content...

Does this make sense....

Does ar(3) still work is it fixed folder?
"Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
news:ecHtFKTUDHA.3700@tk2msftngp13.phx.gbl...
> > > This is where using ar(3) would always get the base subfolder...
> >
> > True - depends on what he wants. He DID say " ... everything from before
> the
> > last "/" ..."
>
> Right, which is why I didn't say, "you should use ar(3) instead." :-)
>
>



Re: String manipulation of a URL - strip preceding characters? by jason

jason
Wed Jul 23 11:52:55 CDT 2003

Thanks


"Bob Barrows" <reb_01501@yahoo.com> wrote in message
news:O7cT8FTUDHA.2420@TK2MSFTNGP10.phx.gbl...
> Aaron Bertrand - MVP wrote:
> >> However, who is to say that your string might not contain
> >> "http://www.essermanyachtsales.com/riverbend/default.asp"?
> >> Now, you would have to do this:
> >> ar = split(str,"/")
> >> response.write ar(ubound(ar)-1)
> >
> > Except what if it is
> > "http://www.essermanyachtsales.com/riverbend/subfolder/default.asp"?
> >
> > This is where using ar(3) would always get the base subfolder...
>
> True - depends on what he wants. He DID say " ... everything from before
the
> last "/" ..."
>
> Bob
>
>



Re: String manipulation of a URL - strip preceding characters? by jason

jason
Wed Jul 23 11:53:44 CDT 2003

Thanks - stupid question: What if I always wanted to get the LAST subfolder
in the url no matter how many subfolders appear in the url....would this
still work?

- Jason
"Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
news:ecHtFKTUDHA.3700@tk2msftngp13.phx.gbl...
> > > This is where using ar(3) would always get the base subfolder...
> >
> > True - depends on what he wants. He DID say " ... everything from before
> the
> > last "/" ..."
>
> Right, which is why I didn't say, "you should use ar(3) instead." :-)
>
>