最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Java实现去掉字符串重复字母的方法示例
时间:2022-06-29 01:01:03 编辑:袖梨 来源:一聚教程网
本文实例讲述了Java实现去掉字符串重复字母的方法。分享给大家供大家参考,具体如下:
package demo; public class Ctrl { public static void main(String[] args){ String s = "akkbcccrsa"; System.out.println("脚本之家测试结果:"); System.out.print("原字符串:"); System.out.println(s); Ctrl sctrl = new Ctrl(); System.out.print("去重之后的字符串:"); System.out.println(sctrl.rmRepeated(s)); } /* * 清除字符串中重复字母算法 */ String rmRepeated(String s){ int len = s.length(); int k = 0; int count = 0; String str = ""; char[] c = new char[len]; for(int i=0;i
运行结果:
相关文章
- 四海兄弟故乡豪华版和标准版有什么区别 豪华版专属内容介绍 08-21
- 伊瑟最强角色是什么 强力角色推荐 08-21
- 消逝的光芒困兽多少钱 各平台版本价格介绍 08-21
- 龙魂旅人庞培用秘法套好吗 秘法套好处分享 08-21
- 消逝的光芒困兽什么时候出 游戏上线日期一览 08-21
- 龙魂旅人荆的面板暴击要多少能换迅捷光环 面板暴击一览 08-21