|
-
Feb 5th, 2008, 04:20 PM
#1
Thread Starter
Lively Member
Removing Code from a text file.
HEllo community, I have an odd question.
THis is a VB question because i want to automate this procedure with an app.
Import text file.. Strip.. then save striped version..
I have to format some HTML code by stripping out the script sections...
For example..This is what i have
Code:
<html>
<body> yadda
<script> yadda yadda
</Script>
<br>
<script> yadda yadda
</Script>
</body>
</html>
THis is what i want...
Code:
<html>
<body> yadda
<br>
</body>
</html>
Im seeking help on the logic used to parce through the text file removing the scripting elemets as it finds them...
VB.Net uber-noob since04, Yeababy! 
-
Feb 5th, 2008, 04:25 PM
#2
Re: Removing Code from a text file.
Well, you can use some Regex to find the tags or you could just use the IndexOf method of a string to find it.
Pseudo Code:
Code:
Integer First = 0, Second = 0
First = MyText.IndexOf(0, "<script>")
Second = MyText.IndexOf(First, "</script>")
MyText = MyText.Remove(First, Second)
Adjust and repeat as necessary.
-
Feb 5th, 2008, 04:34 PM
#3
Thread Starter
Lively Member
Re: Removing Code from a text file.
SO i can put that in a loop as it finds each start script tag <script> then execute the code as it parces through the document...?
VB.Net uber-noob since04, Yeababy! 
-
Feb 5th, 2008, 05:58 PM
#4
Re: Removing Code from a text file.
 Originally Posted by smilbuta
SO i can put that in a loop as it finds each start script tag <script> then execute the code as it parces through the document...?
Yup. Put it in a loop and when it find a start and the next tag (the ending tag), kill it, and loop again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|