Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 10th, 2004, 09:37 AM
Authorized User
 
Join Date: Jun 2003
Location: , , Netherlands.
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default mid-function not working (i did something wrong)

Hi,

i've put together this nice piece of code:

Code:
strTempContent="<table><tr><td>testje</td></tr></table>"

response.write strTempContent&"<br>"

do while ((instr(1,strTempContent,"<")<>0) and (instr(1,strTempContent,">")<>0))
    posBegin=instr(1,strTempContent,"<")
    posEnd=instr(1,strTempContent,">")
    string1=mid(strTempContent,posBegin,posEnd)
    %><script>alert('<%=strTempContent%>' + ' --- ' + <%=posBegin%>+' - '+<%=posEnd%> + ' --- ' + '<%=string1%>')</script><%
    strTempContent=replace(strTempContent,string1,"")
loop
The purpose of the script is to filter the html-tags out of the variable "strTempContent". This works fine for the first 3 tags (<table><tr><td>), but then it suddenly wants to replace the following tag: "</td></tr><" instead of "</td>". i really don't get it because the mid-function is called with these arguments: mid("testje</td></tr></table>",7,11). this should return "</td>" and not "</td></tr><". What am i missing??

Greetz,

Harold
Reply With Quote
  #2 (permalink)  
Old February 10th, 2004, 09:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

The parametres of mid aren't begin and end, but begin and length...

So this:
mid("testje</td></tr></table>",7,11)

Should be this:
mid("testje</td></tr></table>",7,5)

Reply With Quote
  #3 (permalink)  
Old February 10th, 2004, 09:50 AM
Authorized User
 
Join Date: Jun 2003
Location: , , Netherlands.
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Jonax
 The parametres of mid aren't begin and end, but begin and length...

So this:
mid("testje</td></tr></table>",7,11)

Should be this:
mid("testje</td></tr></table>",7,5)
i'm very ashamed now

but thanks a lot :)
Reply With Quote
  #4 (permalink)  
Old February 11th, 2004, 04:58 AM
Authorized User
 
Join Date: Jul 2003
Location: Athens, , Greece.
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check out Regular Expressions for ASP. They are more efficient when it comes to that kind of tasks..Try a search in Google

Cheers

Kostas Lagos


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Contains function call not working correctly cnatale XSLT 7 May 8th, 2008 07:53 AM
mid umeshtheone Beginning VB 6 1 June 11th, 2007 02:49 PM
Using MID in SQL server rtr1900 Classic ASP Databases 0 December 13th, 2005 12:21 PM
search function not working locally Henry 8 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 December 19th, 2004 12:31 PM
Chapter 6 Edit function isn't working Graham76 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 3rd, 2004 10:23 PM



All times are GMT -4. The time now is 05:44 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.