On this program, we are going to study The right 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 Packages 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 examine the characters in any other case capital characters and small alphabetical characters can 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 sensible Uppercase and inputString = //consequence for holding the distinct string consequence = string.Empty; //Loop via every character of for (int i = 0; i < inputString.Size; { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â consequence += inputString[i]; Â Â Â } //Present the ultimate consequence to the Console.WriteLine(consequence); //Console.ReadLine() to carry the Console.ReadLine(); |
Output:
I hope this instance will assist in your interview/examination preparation.
Thanks

