-
Hi Everyone, After a Long Time..Eh..
I have a coldfusion file that contains html (!--HTML Comments--> and coldfusion comments<!---CFML Comments--->
I need to find all the comment blocks and remove it. Is it possible to do this in VB. A program that takes the filename a parameter and removes all the comments inside the file.
Please do help me immdly as i have to convert this into ocx file and convert into a component and use it in coldfusion custom tags for getting my project work.
Thanx for any help..
(BTW How are you Serge....)
Venkat.
-
Try this:
Code:
Dim hFile As Long
Dim sFileName As String
Dim sContents As String
Dim sLine As String
Dim I As Integer
Dim iTemp As Integer
'Store the filename in sFileName
hFile = FreeFile
Open sFileName For Input As hFile
Do While Not EOF(hFile)
Line Input #hFile, sLine
sContents = sContents & sLine & vbCrLf
Loop
Close hFile
Do
DoEvents
I = InStr(1, sContents, "<!--")
If I = 0 Then Exit Do
iTemp = InStr(I, sContents, "-->")
If iTemp = 0 Then Exit Do
sContents = Left(sContents, I - 1) & Right(sContents, Len(sContents) - (iTemp + 2))
Loop
hFile = FreeFile
Open sFileName For Output As hFile
Print #hFile, sContents
Close hFile
Let me know if it works, I wrote the code directly to the post.
-
Thank U
Thanx man,
will try it and get back to u if i have any problem..
regards,
venkat.