- AuthorPosts
- June 16, 2008 at 8:09 pm #5904jackrabbitMember
Hi All,
I have a text file. I plan to search through the file and if any line start with word “parameters”, I wanted to command it out as “;parameter”, then add a new line after it and insert text “.param”.
Here is my code and it does not work.
nLines=document.GetLines();
for(i=1; i < nLines; i++) {
str = document.GetLine (i);
n = str.indexOf(“parameters”);
if (n==0){
document.selection.Text =”;parameters”;
document.selection.NewLine();
document.selection.Text =”param”;
}
}Another issue. How can I automatically update the line number? Since I insert new line each time I find “paramter”, the total line number changed.
Thanks for your help.
June 17, 2008 at 7:33 am #5906kuo_cityMemberUse Find And Replace with Regular Expression
Find:^s*parameters.*$
Replace:;n.paramJune 17, 2008 at 4:28 pm #5911jackrabbitMemberThank you very much. This is very helpful.
- AuthorPosts
- You must be logged in to reply to this topic.