c# - execute while block until one of three conditions raises -


i want actions until 1 of following conditions satisfied^

  • html.indexof("/>")==0
  • html.indexof("</"+tagname+">")==0
  • html[0]=='<'

where here html actualy string. have tried - apply or operation inversed conditions. wrong. how properly. here's code:

while((html.indexof("/>")!=0)&&(html.indexof("</"+tagname+">")!=0)||(html[0]!='<')) {     html = html.remove(0, 1); } 

you mixing , and or reason. have

while(a && b || c)  

but want write

while(a && b && c)  

the code should read:

while (   (html.indexof("/>")!=0)         &&(html.indexof("</"+tagname+">")!=0)         &&(html[0]!='<')) 

i echo @cdhowie's comment. using html parser make code easier read , write, , make more robust varied input.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -