469,336 Members | 5,157 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

Parsing a string

Lets say I have a string like "www.ssss.com/images/theimage.jpg"

I want to parse the string and just return the image: theimage.jpg
Jul 19 '05 #1
9 3026
"DaveF" <df*****@geodecisions.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Lets say I have a string like "www.ssss.com/images/theimage.jpg"

I want to parse the string and just return the image:

theimage.jpg

Const s = "www.ssss.com/images/theimage.jpg"
Response.Write Mid(s,InStrRev(s)+1)
Jul 19 '05 #2
I get
Wrong number of arguments or invalid property assignment: 'InStrRev'

Const strURL = "www.ssss.com/images/theimage.jpg"
Response.Write Mid(strURL,InStrRev(strURL)+1)
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"DaveF" <df*****@geodecisions.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Lets say I have a string like "www.ssss.com/images/theimage.jpg"

I want to parse the string and just return the image:

theimage.jpg

Const s = "www.ssss.com/images/theimage.jpg"
Response.Write Mid(s,InStrRev(s)+1)

Jul 19 '05 #3
I got it
strURL = "www.ssss.com/images/theimage.jpg"
Response.Write Mid(strURL,InStrRev(strURL, "/") +1)
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"DaveF" <df*****@geodecisions.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Lets say I have a string like "www.ssss.com/images/theimage.jpg"

I want to parse the string and just return the image:

theimage.jpg

Const s = "www.ssss.com/images/theimage.jpg"
Response.Write Mid(s,InStrRev(s)+1)

Jul 19 '05 #4
"DaveF" wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
: Lets say I have a string like "www.ssss.com/images/theimage.jpg"
:
: I want to parse the string and just return the image: theimage.jpg

dim str, file
str = "www.ssss.com/images/theimage.jpg"
file = split(str,"/")
Response.Write(file(ubound(file)))
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 19 '05 #5
Roland Hall wrote on 18 mrt 2004 in
microsoft.public.inetserver.asp.general:
dim str, file
str = "www.ssss.com/images/theimage.jpg"
file = split(str,"/")
Response.Write(file(ubound(file)))


in jscript it is even nicer: str.split("/").pop()

===========

<script>

var response = document // for clientside jscript test

var str = "www.ssss.com/images/theimage.jpg"
response.write(str.split("/").pop())

</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #6
"DaveF" <df*****@geodecisions.com> wrote in message
news:ea****************@tk2msftngp13.phx.gbl...
I got it
strURL = "www.ssss.com/images/theimage.jpg"
Response.Write Mid(strURL,InStrRev(strURL, "/") +1)


Doh! Sorry. That's what I get for CBTSOMP (coding by the seat of my
pants.) Glad you got it working.
Jul 19 '05 #7
"Evertjan." wrote in message news:Xn********************@194.109.133.29...
: Roland Hall wrote on 18 mrt 2004 in
: microsoft.public.inetserver.asp.general:
: > dim str, file
: > str = "www.ssss.com/images/theimage.jpg"
: > file = split(str,"/")
: > Response.Write(file(ubound(file)))
:
: in jscript it is even nicer: str.split("/").pop()
:
: ===========
:
: <script>
:
: var response = document // for clientside jscript test
:
: var str = "www.ssss.com/images/theimage.jpg"
: response.write(str.split("/").pop())
:
: </script>

Yes, it is nice to do it all in one statement and I was trying to do that
with vbscript and couldn't figure out a way to do it. Is it possible to do
this on the server side?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 19 '05 #8
Roland Hall wrote on 18 mrt 2004 in
microsoft.public.inetserver.asp.general:
"Evertjan." wrote in message
news:Xn********************@194.109.133.29...
: in jscript it is even nicer: str.split("/").pop()
:
: ===========
:
: <script>
:
: var response = document // for clientside jscript test
:
: var str = "www.ssss.com/images/theimage.jpg"
: response.write(str.split("/").pop())
:
: </script>

Yes, it is nice to do it all in one statement and I was trying to do
that with vbscript and couldn't figure out a way to do it. Is it
possible to do this on the server side?


Sure.

You can do all your asp script in jscript, if you like.

Alternatively you can define certain functions in jscript and the main
code in vbscript.

<script runat="server" type="text/jscript">
function getLastpart(str)
return str.split("/").pop()
</script>

<%
'' this is vbscript
Response.Write getLastpart("www.ssss.com/images/theimage.jpg")
%>

Not tested!

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #9
"Roland Hall" <nobody@nowhere> wrote in message
news:uX**************@TK2MSFTNGP10.phx.gbl...
"Evertjan." wrote in message news:Xn********************@194.109.133.29...
: Roland Hall wrote on 18 mrt 2004 in
: microsoft.public.inetserver.asp.general:
: > dim str, file
: > str = "www.ssss.com/images/theimage.jpg"
: > file = split(str,"/")
: > Response.Write(file(ubound(file)))
:
: in jscript it is even nicer: str.split("/").pop()
:
: ===========
:
: <script>
:
: var response = document // for clientside jscript test
:
: var str = "www.ssss.com/images/theimage.jpg"
: response.write(str.split("/").pop())
:
: </script>

Yes, it is nice to do it all in one statement and I was trying to do that
with vbscript and couldn't figure out a way to do it. Is it possible to do this on the server side?


str = "www.ssss.com/images/theimage.jpg"
Response.Write( mid(str,InStrRev(str,"/")+1,Len(str)) )

Regards,
Peter Foti
Jul 19 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Gerrit Holl | last post: by
6 posts views Thread by BerkshireGuy | last post: by
3 posts views Thread by aspineux | last post: by
2 posts views Thread by RG | last post: by
6 posts views Thread by gw7rib | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.