统计文件中字符串出现的频率
来源:互联网 发布:little mac 唇膏 编辑:程序博客网 时间:2024/04/28 12:16
public int countString(String word,String fileName) throws Exception{
int count=0;
FileReader fr=new FileReader(fileName);
BufferedReader br=new BufferedReader(fr);
String line=null;
while ((line = br.readLine()) != null) {
int index = -1;
while (line.length() >= word.length() && (index = line.indexOf(word)) >= 0) {
count++;
line = line.substring(index + word.length());
}
}
return count;
}
int count=0;
FileReader fr=new FileReader(fileName);
BufferedReader br=new BufferedReader(fr);
String line=null;
while ((line = br.readLine()) != null) {
int index = -1;
while (line.length() >= word.length() && (index = line.indexOf(word)) >= 0) {
count++;
line = line.substring(index + word.length());
}
}
return count;
}
1 0
- 统计文件中字符串出现的频率
- 统计文件中单词出现的频率
- 使用hash算法统计字符串中字符出现的频率
- 统计字符串中出现频率最高的字符
- 统计字符串中出现频率最高的字符
- java统计文件中字母出现的频率
- Hadoop Demo(一)【统计文件中单词出现的频率】
- 统计字符串各字母出现的频率
- js统计字符串出现的频率
- 统计字符串中每个字符的出现频率,返回一个 Object,key 为统计字符,value 为出现频率
- 读入一个字符串,统计字符串中不同字符的出现频率。
- 统计一个字符串中出现的最大频率字符;若有频率相同字符,按字典序输出
- 统计字符串中字符的种类和每种字符出现的频率
- C—统计字符串中出现频率最高的符号(所有ASCII码)
- 统计字符串里面出现频率最高的字符
- 小程序:统计字符串出现的种类和频率
- 统计文件中各单词出现的频率(二叉排序树实现)
- 统计文件中各单词出现的频率(Hash表实现)
- Ptrace 详解
- sdutacm-数据结构实验之查找二:平衡二叉树
- JAVA语言程序设计(基础篇)第九章答案
- hdu 2503 a/b+c/d(基础数论)
- [CSU 1818 Crusher's Code Submit]记忆化递推
- 统计文件中字符串出现的频率
- 欢迎使用CSDN-markdown编辑器
- 微信公众平台测试账号 接口信息配置失败解决方法
- sdutacm-Fence Repair
- Lua 实验,数据类型相关
- 按PEP8风格自动排版Python代码
- 我的物联网综合知识之整体架构
- Zookeeper(四)Acl权限控制
- 逆向-数据宽度与逻辑运算