• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the total no. of Lines of a text file

 
Mullin Yu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as subject!
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using the LineNumberReader class. Set it up something like this:

Then keep calling readLine() to read each line as a String, and getLineNumber() to determine which line you are on (note it starts counting at zero).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic