If order does not matter, you can use foo = "mppmt" "".join(set(foo)) set() will create a set of unique letters in the string, and "".join() will join the letters back to a string in arbitrary order. If order does matter,
三种java 去掉字符串中的重复字符函数 public static void main(string[] args) { system.out.println(removerepeatedchar("ddddccffgd")); } public static string removerepeatedchar(string s) { if (s == null) return s; stringbuilder sb = new stringbuilder(); , len = s.
python 判断字符串中是否只有中文字符 学习了:https://segmentfault.com/q/1010000007898150 def is_all_zh(s): for c in s: if not ('\u4e00' <= c <= '\u9fa5'): return False return True