本帖最后由 viphk 于 2011-04-21 22:08:13 编辑

解决方案 »

  1.   

    把字符串里德字符保存在数组里,比如ArrayList里
    str1="A";
    str2="B";
    str3="A";
    ArrayList list1=new ArrayList();
    ArrayList list2=new ArrayList();
    list1.Add(str1);
    list1.Add(str2);
    list1.Add(str3);
    list2.Add(str1);
    list2.Add(str2);
    list2.Add(str3);
    for(int i=0;i<list1.count;i++)
    {
       for(int j=list2.count-1;j>i;j--)
       {
          if(list[i]==list[j])
          {
              //这里面自己处理啊,代码在公司,不想再写一遍了
           }
       }
    }
    }
      

  2.   


     string str = "COOCON";            str = Regex.Replace(str, "(?s)(.)(?=.*\\1)", "");            Console.WriteLine(str);
      

  3.   

    用Linq...
    str.Distinct().Count() < str.Length //成立有重复值,否则无