计算剪贴板里仿制的代码行数
2013-02-16 02:30
176 查看
[文件] ClipCodeCount.java ~ 1KB 下载(2) import java.awt.*; import java.awt.datatransfer.*; import java.io.*; import java.util.regex.*; public class ClipCodeCount { /** * 正则表达式主要是匹配多行注释 */ http://www.fpshamen.com/linked/20130215.do; private static Pattern pattern = Pattern.compile("/\\*([\\s|\\S]) ?\\*/"); /** * 计算文本中的代码行数 1.用正则表达式出去块注释即多行注释 2.再将字符串依照回车符分割成字符串数组 3.除掉空白行或许单行注释行 * * @param content * 输入文本 * @return 文本中代码行数 */ public static int getCodeCount(String content) { int rowCount = 0; Matcher matcher = pattern.matcher(content); content = matcher.replaceAll(" "); String ss[] = content.split("\n"); for (String s : ss) { if (s.trim().length() > 0
相关文章推荐
- 计算编写代码行数
- IOS学习--Foundation--计算文件中得代码行数(小练习)
- 第十七篇:计算代码行数练习代码
- 计算整个文件夹的代码行数
- 精确计算TFS中新增以及更改的代码行数
- JAVA作业—从命令行输入两个参数打开文件并计算代码行数 .
- php 计算代码行数
- 一个简单的代码计算行数demo编写
- 黑马程序员————IOS学习笔记 第11篇 经典示例计算代码行数
- (转)python 计算代码行数以及相关知识点
- oc 计算代码行数
- 用js实现计算代码行数的简单方法附代码
- 黑马程序员---Foundation常用类练习(计算文件代码行数)
- linux系统-代码行数计算
- C#计算代码行数
- Java计算代码行数
- Python计算一个项目中含有的代码行数
- iOS——计算项目代码行数
- 计算代码行数Demo源码
- 如何计算C++有效代码行数?