Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    i need to remove all lines containing text from each line in downloaded.txt....

    i need to remove all lines containing text from each line in downloaded.txt from the file download.txt.


    So I have a function Remcon.

    I need Remstr = to every line of downloaded.txt , and text ill fix my self.

    function remcon()
    {

    var text = document.form_rli.input_output.value;
    var remstr = "";
    var addstr = document.form_rli.to_add.value;
    var count = 0;
    if (addstr.length > 0) addstr = addstr + '\n'; else addstr = '';
    if (addstr.length > 0) counttype = ' lines were replaced.'; else counttype = ' lines were removed.';
    var textout = new Array();
    text = text.replace(/\r/g,'');
    text = text.split('\n');
    if (remstr.length == '0') remstr = '___EMPTY_INPUT___';
    for (var x = 0; x < text.length; x++){
    if (document.form_rli.case_sen.checked == false) if (text[x].toLowerCase().indexOf(remstr.toLowerCase()) == -1) textout[x] = text[x]; else {textout[x] = addstr + "___ARRAY_REMOVED___"; count++;}
    if (document.form_rli.case_sen.checked == true) if (text[x].indexOf(remstr) == -1) textout[x] = text[x]; else {textout[x] = addstr + "___ARRAY_REMOVED___"; count++;}}
    textout = textout.join('\n');
    textout = textout.replace(/___ARRAY_REMOVED___\n/g,'');
    textout = textout.replace(/\n___ARRAY_REMOVED___/g,'');
    textout = textout.replace(/___ARRAY_REMOVED___/g,'');
    document.form_rli.input_output.value = textout;
    document.getElementById('removed').innerHTML = count + counttype;
    }

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by kizm0 View Post
    i need to remove all lines containing text from each line in downloaded.txt from the file download.txt.
    Er, don't all the lines in download.txt contain well, er, text?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •