 |
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 10th, 2004, 09:37 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

February 10th, 2004, 09:43 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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)
|
|

February 10th, 2004, 09:50 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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 :)
|
|

February 11th, 2004, 04:58 AM
|
|
Authorized User
|
|
Join Date: Jul 2003
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|
 |