Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5904

    jackrabbit
    Member

    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.

    #5906

    kuo_city
    Member

    Use Find And Replace with Regular Expression
    Find:^s*parameters.*$
    Replace:;n.param

    #5911

    jackrabbit
    Member

    Thank you very much. This is very helpful.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.