开发者

C# check line number of stringreader [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜