There is a list of strings:

123456:Ответ 1234:Ответ-1008! 1234567:Ответ-232! 12345:Отв 

It is necessary to exclude lines in which, if after the sign: or; - less than 3 characters. And write down all the lines in which after the sign: or; - characters greater than 3.

In this case, the result should be:

  123456:Ответ 1234:Ответ-1008! 1234567:Ответ-232! 

It seems to be moving in the right direction, but alas, it does not work.

 if (PosEx(':', stroka)=0) or (PosEx(';', stroka)=0) and (length(stroka) <3) 
  • 2
    It seems to be in the wrong, if ( (length(stroka)-PosEx(':',stroka)<3)) , further on. - Vladimir Klykov
  • one
    at 123456:Ответ after a colon of as many as 5 characters, why is it not as a result? - teran
  • @ teran; Sorry, the typo came out. Already fixed the question. - Denis
  • @Vladimir Klykov, Made the answer to this question, thanks to you solved the problem. - Denis

1 answer 1

Answered the question thanks to the user - Vladimir Klykov.

 if (length(stroka)-PosEx(':',stroka) < 3) or (length(stroka)-PosEx(';',stroka) < 3) then break else 

And it is even better not to produce negatives and rewrite if not ((A) or (B)) to if (not A) and (not B), i.e. will be:

 if (length(stroka)-PosEx(':',stroka) >= 3) and (length(stroka)-PosEx(';',stroka) >= 3) then 
  • one
    in order not to make a break you can write a condition like if not (...) then ...; - Vladimir Klykov
  • one
    Since this answer solved your problem - click on the check mark under the up and down arrows to mark the answer as final. This will allow future visitors to know for sure that this solution is operational. Thank. - Dima
  • 2
    @Dima this, emnip, the vehicle will not be able to do within 48 hours from the time of the response. - Kromster