This code is sorted by rows.

How to solve this problem: If the line, in a memo , is filled, then take these parameters into account for sorting . And if not filled then do not take into account. In my case, it turns out that all strings, even empty ones, are sorted. What is there to add that would work so?

//работаем по строкам в файле while not Eof(fall) do begin //читаем строку ReadLn(fall, S); if (Pos(AnsiLowerCase(Memo1.Lines[0]), AnsiLowerCase(s)) > 0) then writeln(REZ1, S); if (Pos(AnsiLowerCase(Memo1.Lines[1]), AnsiLowerCase(s)) > 0) then writeln(REZ2, S); if (Pos(AnsiLowerCase(Memo1.Lines[2]), AnsiLowerCase(s)) > 0) then writeln(REZ3, S); ................................ и так далее... 

When I do through checkboxes + Edit, this is how it all works much faster (That is, I tick the edit where they are filled in). But it's not so convenient, it's more convenient through memo:

 while not Eof(fall) do begin //читаем строку ReadLn(fall, S); if CheckBox1.Checked and (Pos(AnsiLowerCase(Edit1.Text), AnsiLowerCase(s)) > 0) then writeln(f1, S); if CheckBox2.Checked and (Pos(AnsiLowerCase(Edit2.Text), AnsiLowerCase(s)) > 0) then writeln(f2, S); if CheckBox3.Checked and (Pos(AnsiLowerCase(Edit3.Text), AnsiLowerCase(s)) > 0) then writeln(f3, S); ................................ и так далее... 
  • one
    I also wanted to ask you something. I sometimes have almost simultaneous voices for my answers - several (many) pieces. Do you know anything about this? - Igor
  • one
    @Igor suspect cheat? - Kromster
  • 2
    @Kromster I suspect a person is well-meaning. Anyway, the system will turn the carriage into a pumpkin. - Igor
  • one
    Igor, I get it. Then I will put on your favorite topics + periodically. I just put these + from the bottom of my heart, even there was nothing wrong with my thoughts. Do not worry, now I will do everything according to these rules. Have a nice evening, the main thing is human understanding, communication and we have it. - Tatyana
  • one
    @ Tatyana I had no doubt that you did it from the heart. I was worried, first of all, that you would not be subject to administrative sanctions for this. See you at StackOverflow. - Igor

1 answer 1

 if (Memo1.Lines[0] <> '') and (Pos(AnsiLowerCase(Memo1.Lines[0]), AnsiLowerCase(s)) > 0) then writeln(f1, S); 
  • Here for some reason he writes a mistake. I can not understand ... - Tatiana
  • one
    @ Tatyana What mistake? - Igor
  • one
    And you need to add brackets around the conditions - Kromster
  • Here is the text at compilation: Tatiana
  • one
    "Implicit data loss with data loss" is not a mistake, but a warning .. - Kromster