Pergunta

How do I check if the string reader has passed a certain line number, or has passed a line number which contains some text? I put this in the line processing code of a string reader:

if (currentline.Contains("123"))
         currentbank = "123";  
else if (currentline.Contains("456"))    
         currentbank = "456";    
else if (currentline.Contains("789"))    
         currentbank = "789";  

I want to change the contents of a string based on what range of line numbers it is in, with my code it always gives 123. Like for example if it's from lines 10-20 (or from 123 to 456) then the string should have 123, 20-30 (or 456 to 789) it should have 456 and 30-40 have 789. How can I do this using a StringReader?

Foi útil?

Solução

Fixed it myself, problem being I used upper case (e.g. TEST) instead of lower case.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top