On this program, we’ll study The way to take away the duplicate character from the string in C#.
I’ll suggest you to verify the beneath hyperlink for Prime C# Interview Applications requested through the Interview and Examination.
Program to take away the duplicate character from the string
As C# within the case-sensitive language, I’m changing the string to the lowercase string in order that I can evaluate the characters in any other case capital characters and small alphabetical characters will probably be handled as completely different characters.
Program to take away the duplicate character from the string in C# in talked about beneath:
Console.WriteLine(“Enter a string to take away duplicate character from //Obtain enter from the consumer string inputString = Console.ReadLine(); //Changing the inputString to //different clever Uppercase and inputString = //outcome for holding the distinct string outcome = string.Empty; //Loop by means of every character of for (int i = 0; i < inputString.Size; { outcome += inputString[i]; } //Present the ultimate outcome to the Console.WriteLine(outcome); //Console.ReadLine() to carry the Console.ReadLine(); |
Output:
I hope this instance will assist in your interview/examination preparation.
Thanks