7. Write a program to remove duplicate element ?
It will remove exist duplicate element into the given string.
Ex : Tutorial
after the remove element Tuorial
using System;
using System.Text;
public class Program
{
public static void Main()
{
var data = "csharp-tutorial";
var results = new StringBuilder();
foreach(var val in data)
{
if(results.ToString().IndexOf(val)==-1)
{
results.Append(val);
}
}
Console.Write(results);
}
}
Output
csharp-tuoil