简体   繁体   中英

text file: Reading file line by line

but after reading file getting output of 2nd Line is not getting with same space.why

THE industrial area layout                              date 11/12/2020                            
Head office                                             page no                             
   
  

below is my code

 lines = File.ReadAllLines(path,Encoding.UTF8));

text file:

  THE industrial area layout                              date 11/12/2020                            
  Head office                                             page no    

After Reading:

  THE industrial area layout                              date 11/12/2020                            
  Head office                               page no                            

How would i be able to do this? Thanks in advance.

Make sure you are analyzing the content with the same font, more specifically make sure you have monospace fonts otherwise you might get confused related to the spaces.

I would suggest Courier New.

What you see in the debugger text view doesn't use a monospace font by default so it's unreliable when checking the number of spaces between lines especially when there's other content besides spaces.

Another way to check the number of spaces is to replace them with some other character so that you can count them visibly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM