Removing Repetitive Characters from the string

Dheeraj Kumar Gunti

Reading Time : ( words)


var test = "Thiiiiiiiiiiisssssssss iiiiiisssssss ttttttteeeeessssssssst apppppppppllllliiiiccationnnnn";
            test.Distinct().Select(c => c.ToString()).ToList()
    .ForEach(c =>
    {
    while (test.Contains(c + c))
                        test = test.Replace(c + c, c);
    });