473,574 Members | 2,498 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parsing a string

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

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

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

theimage.jpg

Const s = "www.ssss.c om/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.c om/images/theimage.jpg"
Response.Write Mid(strURL,InSt rRev(strURL)+1)
"Chris Hohmann" <no****@thankyo u.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
"DaveF" <df*****@geodec isions.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Lets say I have a string like "www.ssss.c om/images/theimage.jpg"

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

theimage.jpg

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

Jul 19 '05 #3
I got it
strURL = "www.ssss.c om/images/theimage.jpg"
Response.Write Mid(strURL,InSt rRev(strURL, "/") +1)
"Chris Hohmann" <no****@thankyo u.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
"DaveF" <df*****@geodec isions.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Lets say I have a string like "www.ssss.c om/images/theimage.jpg"

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

theimage.jpg

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

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

dim str, file
str = "www.ssss.c om/images/theimage.jpg"
file = split(str,"/")
Response.Write( file(ubound(fil e)))
--
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.publi c.inetserver.as p.general:
dim str, file
str = "www.ssss.c om/images/theimage.jpg"
file = split(str,"/")
Response.Write( file(ubound(fil e)))


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

===========

<script>

var response = document // for clientside jscript test

var str = "www.ssss.c om/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*****@geodec isions.com> wrote in message
news:ea******** ********@tk2msf tngp13.phx.gbl. ..
I got it
strURL = "www.ssss.c om/images/theimage.jpg"
Response.Write Mid(strURL,InSt rRev(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******** ************@19 4.109.133.29...
: Roland Hall wrote on 18 mrt 2004 in
: microsoft.publi c.inetserver.as p.general:
: > dim str, file
: > str = "www.ssss.c om/images/theimage.jpg"
: > file = split(str,"/")
: > Response.Write( file(ubound(fil e)))
:
: in jscript it is even nicer: str.split("/").pop()
:
: ===========
:
: <script>
:
: var response = document // for clientside jscript test
:
: var str = "www.ssss.c om/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.publi c.inetserver.as p.general:
"Evertjan." wrote in message
news:Xn******** ************@19 4.109.133.29...
: in jscript it is even nicer: str.split("/").pop()
:
: ===========
:
: <script>
:
: var response = document // for clientside jscript test
:
: var str = "www.ssss.c om/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("ww w.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******** ******@TK2MSFTN GP10.phx.gbl...
"Evertjan." wrote in message news:Xn******** ************@19 4.109.133.29...
: Roland Hall wrote on 18 mrt 2004 in
: microsoft.publi c.inetserver.as p.general:
: > dim str, file
: > str = "www.ssss.c om/images/theimage.jpg"
: > file = split(str,"/")
: > Response.Write( file(ubound(fil e)))
:
: in jscript it is even nicer: str.split("/").pop()
:
: ===========
:
: <script>
:
: var response = document // for clientside jscript test
:
: var str = "www.ssss.c om/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.c om/images/theimage.jpg"
Response.Write( mid(str,InStrRe v(str,"/")+1,Len(st r)) )

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
9432
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 $ Last-Modified: $Date: 2003/10/28 19:48:44 $ Author: A.M. Kuchling <amk@amk.ca> Status: Draft Type: Standards Track
2
3936
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 Canonicalpath-Directory4: \\wkdis3\ROOT\home\bwe\ You selected the file named AAA.XML getXmlAlgorithmDocument(): IOException Not logged in
6
7646
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, GROUP, etc. Thank you, Brian
9
1974
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 ArrayList? I have tried looping through the logfile using regex, if statements and flags to find the start and end of each message but I do not see a...
3
3303
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: “Unexpected end of file while parsing Name has occurred” isbeing thrown. Following is the part o xml I am trying to read: <CHECK_ITEM_OUT>
3
2693
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 RN(name, regex): """protect using () and give an optional name to a regex""" if name:
2
4854
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 data reading. For instance this is my buffer string: 012301234FFFFFFxFFFFFFxFFFFFFx Where the FFFFFF is my Hex data I need to read. I am using...
6
1917
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 creating a class to do parsing. It could be used as follows: int a, n, x, y; Parser par; par << string;
1
2957
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. I've tried doing pre processing with find/replace to get rid of these characters but then I get another type of error "An unexpected end of file...
1
4368
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 Stack code and parsing code my professor i does not like me using buffer reader on my code and my professor did even give me an example code for parsing...
0
7815
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
7738
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8258
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7833
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8118
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5635
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5321
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3770
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1081
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.