이것은 자바 파일의 다른 줄 수를 계산하는 코드의 일부입니다. 대부분의 경우,이 코드는 권리를 얻을 수 number.But 주석 라인 같은 경우 :자바 파일에서 주석 행을 계산하는 방법은 무엇입니까?
/* .......
* .......
*/
단지 두 줄
for eachLine in allLines:
if eachLine != " " :
eachLine = eachLine.replace(" ",""); #remove space
eachLine = self.trim(eachLine); #remove tabIndent
if (iscomment==False):
if(eachLine.strip().startswith("//")): #LINECOMMENT
commentCount += 1;
if eachLine == "":
blankCount += 1;
if(eachLine.strip().startswith("/*")):
commentCount += 1;
if(not eachLine.strip().endswith("*/")):
iscomment=True
else :
commentCount += 1;
if(eachLine.find("*/")):
iscomment=False
lineCount = lineCount + 1;
codeCount=lineCount-commentCount-blankCount
[plyj] (https://github.com/musiKk/plyj) – Selcuk