I was just wondering if there is a simple way of doing this. i.e. Replacing the occurrence of consecutive characters with the same character.
For eg: - if my string is \
string myString = "something likeeeee tttthhiiissss"; char prevChar = ''; StringBuilder sb = new StringBuilder(); foreach (char chr in myString) { if (chr != prevChar) { sb.Append(chr); prevChar = chr; } }