Changeset 29


Ignore:
Timestamp:
05/08/11 18:04:59 (13 years ago)
Author:
phdmakk
Message:

+ fixed LOC counter hanging on empty lines in the beginning of files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/org.etsi.common/src/org/etsi/common/MiscTools.java

    r7 r29  
    116116 
    117117        public static int getLOC(String filename){ 
    118                 int LOC = 0; 
    119118                String code = MiscTools.readFile(filename); 
    120                 int index = 0; 
    121                 while (index != -1) { 
    122                         if (index == 0){ 
    123                                 index = code.indexOf("\n", index); 
    124                         } else { 
    125                                 index = code.indexOf("\n", index + 1); 
    126                         } 
    127                         LOC++; 
    128                 } 
     119                int LOC = code.split("\n").length; 
    129120                return LOC; 
    130121        } 
Note: See TracChangeset for help on using the changeset viewer.