public static void Main()
CleansCharactersFromString();
static void CleansCharactersFromString()
string text = "Hi^>there<<I’m+ telling%%you, you &need% to$ do& your $homeworks.@Hate ^me^ %now% and %thank% me &later.";
string[] elemente = { "^", "<", ">", "&", "+", "@", "%", "$" };
foreach (string element in elemente)
while (text.Contains(element))
index = text.IndexOf(element);
if(text[index-1].Equals(' ') || text[index+1].Equals(' '))
text = text.Remove(text.IndexOf(element), 1);
text = text.Replace(element, " ");