
字符串问题
wndxwn5
这个作者很懒,什么都没留下…
展开
-
判断字符串中是否有重复的字符
public static boolean checkDifferent(String iniString) { TreeSet<Object> set = new TreeSet<>(); for (int i = 0; i < iniString.length(); i++) { if (!set.add(iniString.charAt(i))...原创 2020-02-21 18:11:11 · 792 阅读 · 0 评论 -
统计字符串中出现最多的字符和出现的次数,对map的结果进行排序,使用了comparator方法
HashMap<Character, Integer> map = new HashMap<>(); String str = "eqweqwewqeewqdsadsadfasfhfdgas fsafdsf"; char c = str.charAt(0); for (int i = 0; i < str.length(); i++) { if...原创 2020-02-21 18:09:01 · 134 阅读 · 0 评论