java获取字母出现的次数
来源:互联网 发布:13年总决赛詹姆斯数据 编辑:程序博客网 时间:2024/05/17 01:48
public Count{
public static void main(String[] args) {String str = "ADFGZXCVASDFXCVDF";countLetters(str );
}
public static void countLetters(String str){
if (str == null || str.length == 0){
return;
}str = str.toLowerCase();HashMap<Character, Integer> map = new HashMap<Character, Integer>();for(int i = 0; i<str.length(); i++){char c = str.charAt(i);if (map.containsKey(c)) {map.put(c, map.get(c)+1);}else{map.put(c, 1);}}Iterator<Character> itr = map.keySet().iterator();while(itr.hasNext()){char c = itr.next();System.out.println(c + "("+map.get(c).intValue()+")");}
} }
}
0 0
- java获取字母出现的次数
- java 获取字符串中的字母出现的次数
- java "aababcabcdabcde",获取字符串中每一个字母出现的次数
- java 获取英文语句中每个字母出现的次数
- Java Map集合获取字符串中的字母出现的次数
- Java 获取字符串中 每一个字母出现的次数
- 获取字符串中字母出现的次数
- java统计每个字母出现的次数
- JAVA 获取字符串中每一个字母出现的次数 TreeMap 解
- 黑马程序员_获取字符串 字母出现的次数
- 利用map集合获取字符串中字母出现的次数
- 获取字符串中每个字母出现的次数
- "asdddfgghdsadadf"获取该字符串中的字母出现的次数
- TreeMap获取该字符串中的每个字母出现的次数
- 获取字符串中每一个字母出现的次数
- python 获取字符串中出现次数最多的字母
- 获取字符串中每一个字母出现的次数
- 统计字母出现的次数
- 使用反射的方式修改webview允许跨域
- 图的割点与割边实现
- javaScript常用对象的--Date的用法
- 重定向小结
- OSGi
- java获取字母出现的次数
- 第六周项目2-我的数组类
- execl函数
- Light OJ 1129 Consistency Checker
- 2-12
- linux下代码生成core文件
- poj 3244
- linux内核部件分析之——设备驱动模型之class
- 出现"函数调用中缺少哨兵"的情况(execl)