Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

remove duplicate characters in a string C#

public static string RemoveDuplicates(string input)
{
    return new string(input.ToCharArray().Distinct().ToArray());
}
Comment

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;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: transform.position.x unity 
Csharp :: how to get previous page url aspnet core 
Csharp :: unity create 3d object in script 
Csharp :: unity how to destroy child 
Csharp :: The foreach Loop c# 
Csharp :: how to print statement in c# 
Csharp :: socket io connect to namespace 
Csharp :: detect collision in unity 
Csharp :: c# remove all whitespaces from string 
Csharp :: how to append something to a string in c# 
Csharp :: if checkbox checked in c# 
Csharp :: how to concert a list into strinf splitted by coma c# 
Csharp :: asp.net response.redirect new tab 
Csharp :: unity rotate around axis 
Csharp :: C# new form 
Csharp :: msbuild publish to folder command line .net 
Csharp :: c# how to print 
Csharp :: What is the yield keyword used for in C#? 
Csharp :: how to evaluate code in c# 
Csharp :: c# random number between 0 and 1 
Csharp :: how to get an arrays length in c# 
Csharp :: group by unique c# 
Csharp :: c# modify dictionary in loop 
Csharp :: c# add key value pair to dictionary 
Csharp :: unity get prefabs from folder 
Csharp :: compare two strings in c# 
Csharp :: unity rigidbody2d disable 
Csharp :: sieve of eratosthenes 
Csharp :: working with registry in c# 
Csharp :: async await c# 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =