Results 1 to 2 of 2

Thread: Counting Lines

  1. #1

    Thread Starter
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    Counting Lines

    What are the rules for counting lines of code in a Java program?

    My first guess was every ";", but that won't work for the for loops, which would have 2 lines in themselves...
    Don't pay attention to this signature, it's contradictory.

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Counting Lines

    At first glance I would say, load the file into an array, one line per element.

    Loop through it and subtract 1 for each line that starts with comment character. Subtract 1 for each blank line. I'm not savvy with java syntax so you'll have to make up the rest yourself. There have been line counting threads on VBF before and they discussed the use of Regex patterns, might be worth a look.
    I don't live here any more.

Posting Permissions

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



Click Here to Expand Forum to Full Width