|
-
Jan 11th, 2008, 04:20 AM
#1
Thread Starter
Lively Member
Replace a string in textfile
I am writting table contents into a file .
The contents have to be as follows:
<html>
<body>
<table>
<tr>
<td> SNO</td>
</tr>
<tr>
<td>Name</td>
</tr>
</table>
<table>
<tr>
<td>1</td>
<td>XYZ</td>
</tr>
</table>
</body>
</html>
In this I am able to write the first table succesfully. When i write a second table i give the replace option as:
io.file.replace("</body>","<table></table></body>")
Now when i read the each row inside the second i need to replace the last "</table>" alone with "<tr></tr></table>"
When i give replce option, it replaces in every occurances of </table> and so I am getting the row of the second table in the first table also.
How to find the last occurance of </table> and then replace. Any help in this??????
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
|