📅  最后修改于: 2022-03-11 14:52:22.903000             🧑  作者: Mango
String str2 = "ABABABCDEF";// ABCDEF
String[] arr2 = str2.split("");
str2 = new LinkedHashSet<>(Arrays.asList(arr2)).toString().replace(", ", "");
System.out.println(str2); // ABCDEF