473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

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 3153
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
2
by: Cigdem | last post by:
Hello, I am trying to parse the XML files that the user selects(XML files are on anoher OS400 system called "wkdis3"). But i am permenantly getting that error: Directory0: \\wkdis3\ROOT\home...
6
by: BerkshireGuy | last post by:
Does anyone know of a good function that will parse out parts of an SQL statement that is passed to it in seperate variables? It should be able to parse statements that contain ORDERBY, WHERE,...
9
by: Paulers | last post by:
Hello, I have a log file that contains many multi-line messages. What is the best approach to take for extracting data out of each message and populating object properties to be stored in an...
3
by: Anup Daware | last post by:
Hi Group, I am facing a strange problem here: I am trying to read xml response from a servlet using XmlTextWriter. I am able to read the read half of the xml and suddenly an exception:...
3
by: aspineux | last post by:
My goal is to write a parser for these imaginary string from the SMTP protocol, regarding RFC 821 and 1869. I'm a little flexible with the BNF from these RFC :-) Any comment ? tests= def...
2
by: RG | last post by:
I am having trouble parsing the data I need from a Serial Port Buffer. I am sending info to a microcontroller that is being echoed back that I need to remove before I start the actual important...
6
by: gw7rib | last post by:
I have a program that needs to do a small amount of relatively simple parsing. The routines I've written work fine, but the code using them is a bit long-winded. I therefore had the idea of...
1
by: hd95 | last post by:
In a perfect world my xml feed source would produce perfect xml ..that is not the case I am parsing an XML feed that sometimes has ampersands and dashes in the content that messes up my parsing. ...
1
by: eyeore | last post by:
Hello everyone my String reverse code works but my professor wants me to use pop top push or Stack code and parsing code could you please teach me how to make this code work with pop top push or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.