public void findRepeat(String string){
for (int i=0;i<=string.length()-1;i++){
String temp=string.substring(0,i)+string.substring(i+1);
System.out.println(temp);
//没有查到相同时会返回-1,查到内容时,会单回对应的字母
int index=temp.indexOf(string.charAt(i));
if (index!=-1){
System.out.println(string.charAt(i));
break;
}
}
}

  

相关文章:

  • 2022-12-23
  • 2021-10-15
  • 2021-06-09
  • 2021-08-05
  • 2022-01-23
  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-07
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案