SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2001
    Location
    Tacoma
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    count the number of lines in a file..

    Does anyone know how I could (in javascript, or any client-side lang) cound the number of lines in a given textfile?

    Thanks for any help!
    Ryan

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Ryan,

    As a general rule, you cannot. And I would tend to say, it is impossible in any sort of undoctored manner. Even if the document is document, it would still depend on what the textfile looked like. For example, is any portion of the file declared as a var? What code is being used to create the line breaks ("\r", "\n")? How do you expect to read in the textfile?

    Finally, why would you want to? Perhaps there is another method for achieving whatever effect you are trying for

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •