CODE:
package dms.pastor.lab.groovy
class Stats {
static main(args) {
def num = 0;
new File("C:\\Dom\\workspaces\\sts\\lab\\LabGroovy\\src\\dms\\pastor\\lab\\groovy\\Stats.groovy").eachLine { num++ }
println "File has " + num + " lines.";
}
}
based partly on solution from:http://robbyoconnor.blogspot.co.uk/2008/04/groovy-way-to-count-number-of-lines.html
No comments:
Post a Comment