Ho to remove the duplicate char from the string 



using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace ConsoleApp1

    public class Program

    {

        static void Main(string[] args)

        {

            string input = "Hello world descanding";

            char [] inputvalue = {'a','e','i'};

            string temp = string.Empty;

            int count = 0;

            string valuefinal = string.Empty; 

            for (int i =0;i<input.Length-1;i++)

            {

                for (int j=0;j< inputvalue.Length-1;j++)

                {

                    if (count ==1)

                    {

                        temp = "";

                    }

                    if (!temp.Contains(input[i]))

                    {

                         temp = temp + inputvalue[j];

                        valuefinal = valuefinal + input[i];

                        count = i++;

                    }                    

                }

            }

            Console.WriteLine(valuefinal);  

           Console.ReadLine();


        }

    }

}


Comments