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