最新下载
热门教程
- 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
运行结果:
相关文章
- 富达抢占1%比特币份额,机构购买热潮持续升温 07-05
- 寻道大千神墓联动妖市觅宝活动攻略 07-05
- 币安(Binance)交易所怎么注册?中文官网注册教学指南 07-05
- 寻道大千守墓老人精怪搭配攻略详解 07-05
- 幽游白书宿命觉醒月卡最新改版详解 07-05
- 第一狂战士卡赞全部套装效果一览 07-05