Ask a Question related to ASP, Design and Development.
-
jason #1
String manipulation of a URL - strip preceding characters?
How would I strip out everything from before the last "/" in the following
string generated from request.servervaraibles method:
[url]http://www.essermanyachtsales.com/riverbend/[/url]
....so that I was just left with:
"Riverbend"
Many thanks
Jason
jason Guest
-
How to strip of characters when long text is displayed?
Hi, I was wondering if anyone had some function or has had to strip off characters from a long string. We have a user inteface, and the text is... -
String manipulation
Hi! I am trying to figure out a simple, Perl way to break down any sting similar to the following: $s0 =... -
How to strip HTML markup from string?
Hello, I want to transform text with HTML markup to plain text. Is there some simple way how to do it? I can surely write my own function,... -
Should String#strip take a parameter?
All, Several times I have run across the need to strip characters other than whitespaces from the beginning and/or end of a string. I have... -
Strip Leading Characters ??
I'd like to strip various leading characters from a registration number. for example MA1234 = 1234 987651 = 987651 Q10001 = 10001 The code... -
Aaron Bertrand - MVP #2
Re: String manipulation of a URL - strip preceding characters?
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:
>
> [url]http://www.essermanyachtsales.com/riverbend/[/url]
>
> ...so that I was just left with:
>
> "Riverbend"
>
> Many thanks
>
> Jason
>
>
>
Aaron Bertrand - MVP Guest
-
Bob Barrows #3
Re: String manipulation of a URL - strip preceding characters?
jason wrote:
This particular string is easy:> How would I strip out everything from before the last "/" in the
> following string generated from request.servervaraibles method:
>
> [url]http://www.essermanyachtsales.com/riverbend/[/url]
>
> ...so that I was just left with:
>
> "Riverbend"
>
> Many thanks
>
> Jason
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
Bob Barrows Guest
-
Bob Barrows #4
Re: String manipulation of a URL - strip preceding characters?
Aaron Bertrand - MVP wrote:
True - depends on what he wants. He DID say " ... everything from before the>>> 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...
last "/" ..."
Bob
Bob Barrows Guest
-
Aaron Bertrand - MVP #5
Re: String manipulation of a URL - strip preceding characters?
> > This is where using ar(3) would always get the base subfolder...
the>
> True - depends on what he wants. He DID say " ... everything from beforeRight, which is why I didn't say, "you should use ar(3) instead." :-)> last "/" ..."
Aaron Bertrand - MVP Guest
-
jason #6
Re: String manipulation of a URL - strip preceding characters?
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...> the> >> > > This is where using ar(3) would always get the base subfolder...
> > True - depends on what he wants. He DID say " ... everything from before>> > last "/" ..."
> Right, which is why I didn't say, "you should use ar(3) instead." :-)
>
>
jason Guest
-
jason #7
Re: String manipulation of a URL - strip preceding characters?
Thanks
"Bob Barrows" <reb_01501@yahoo.com> wrote in message
news:O7cT8FTUDHA.2420@TK2MSFTNGP10.phx.gbl...the> 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> last "/" ..."
>
> Bob
>
>
jason Guest
-
jason #8
Re: String manipulation of a URL - strip preceding characters?
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...> the> >> > > This is where using ar(3) would always get the base subfolder...
> > True - depends on what he wants. He DID say " ... everything from before>> > last "/" ..."
> Right, which is why I didn't say, "you should use ar(3) instead." :-)
>
>
jason Guest



Reply With Quote

