Support us on YouTube by Subscribing our YouTube Channel. Click here to Subscribe our YouTube Channel

Tuesday 12 April 2022

Saturday 19 March 2022

Program to remove the duplicate character from the string

In this program, we will learn How to remove the duplicate character from the string in C#.

I will recommend you to check the below link for Top C# Interview Programs asked during the Interview and Examination.

Program to remove the duplicate character from the string
As C# in the case-sensitive language, I am converting the string to the lowercase string so that I can compare the characters otherwise capital characters and small alphabetical characters will be treated as different characters.
Program to remove the duplicate character from the string in C# in mentioned below:

Console.WriteLine("Enter a string to remove duplicate character from it:");

//Receive input from the user

string inputString = Console.ReadLine();

//Converting the inputString to lowercase

//other wise Uppercase and lowercase will be considered as difference character

inputString = inputString.ToLower();

//result for holding the distinct characters

string result = string.Empty;

//Loop through each character of the string

for (int i = 0; i < inputString.Length; i++)

{

    //If character is not added (contains) in the result variable, Add it to the result string

    if (!result.Contains(inputString[i]))

    {

        result += inputString[i];

    }

}

//Show the final result to the user

Console.WriteLine(result);

//Console.ReadLine() to hold the screen after the execution of the program

Console.ReadLine();

Output:

I hope this example will help in your interview/exam preparation.
Thanks
Protected by Copyscape - Do not copy content from this page.

Friday 18 February 2022

Learn Angular in Hindi (YouTube Series)

Recently, we have begun the “Learn Angular in Hindi” Series on our official YouTube channel. Many people commented/wrote us to start a series in Hindi on it. We need your support to make it successful. Please do like 👍 and subscribe ❤  to our channel if found useful. 

Saturday 15 January 2022

How to Install SQLyog Community Edition

In this article, we will learn How to install SQLyog Community Edition in Windows Operating System. Currently, I am using it to access the MySQL Database. In case you are looking to install MySQL or MySQL Workbench then please check the below article.

Subscribe us on YouTube

Subscribe Now

Popular Posts

Contact us

Name

Email *

Message *

Like us on Facebook