Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

remove duplicate characters in a string C#

string removedupes(string s)
{
    string newString = string.Empty;
    List<char> found = new List<char>();
    foreach(char c in s)
    {
       if(found.Contains(c))
          continue;

       newString+=c.ToString();
       found.Add(c);
    }
    return newString;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #duplicate #characters #string
ADD COMMENT
Topic
Name
4+4 =