Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Remove dublicates
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Text; namespace Rextester { public class Program { public static void Main(string[] args) { var str = "dhhgghjkffyihdyjjgefho"; //Your code goes here Console.WriteLine(RemoveDublicates2("Hello, world!")); } public static string RemoveDublicates(string str){ var result = str.Distinct().ToArray(); return new string(result); } public static string RemoveDublicates2(string str){ var resultBuilder = new StringBuilder(); var set = new HashSet<char>(); // var arr = str.ToCharArray(); foreach(char ch in str){ set.Add(ch); }; return new string(set.ToArray()); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Immutable
cpp contact book
mine
First Test With Coder - 3 digit number into digits
Rand things kurs 8 network
Write a program to filter distinct items from the array
Ejercicio 1 clase 8 feb
test
Plt-D v.0.8
timer
Please log in to post a comment.