p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Read a couple of lines??


Message #1 by walter@w... on Tue, 10 Apr 2001 18:37:37
You can use a combination of the Mid and InStr functions to achieve this
result.
1) Read the entire file into a string variable
2) Found what position in the variable ends your begin token e.g. iStart 
Instr(1, sTemplate, "<!-- begin -->", 1) + Len("<!-- begin -->")
3) Found what position in the variable begins your end token e.g. iEnd 
Instr(1, sTemplate, "<!-- end -->", 1)
4) Use Mid to pull out what's between them e.g. sResult = Mid(sTemplate,
iStart, iEnd)

Hope this helps.

>> -----Original Message-----
>> From: walter@w... [mailto:walter@w...]
>> Sent: Tuesday, April 10, 2001 1:38 PM
>> To: Code Clinic
>> Subject: Read a couple of lines??
>> 
>> 
>> Hello,
>> 
>> I have the following problem.
>> 
>> I have made a template like this.
>> 
>> <table>
>> <!-- begin -->
>>  <tr>
>>   <td>menu</td>
>>  </tr>
>> <!-- end -->
>> </table>
>> 
>> Now i want to read from <!-- begin --> till end <!-- end --> 
>> can someone 
>> help me.
>> 
>> thx


  Return to Index