CSharp examples for System:String Algorithm
Remove Duplicate Character from String
using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from w w w . ja v a 2 s . c o m*/ public class Main{ // Remove duplecate character from string public static string RemoveDuplicateCharacter(string inputText) { // initialize array for 0-255 bool[] charArray=new bool[256]; string result=string.Empty; foreach (var character in inputText.ToArray()) { if(charArray[character]) continue; charArray[character] = true; result = result + character; } return result; } }