removeRepeatedChars method
Implementation
@useResult
String removeRepeatedChars() {
if (length <= 1) return this;
final StringBuffer sb = StringBuffer(this[0]);
for (int i = 1; i < length; i++) {
if (this[i] != this[i - 1]) sb.write(this[i]);
}
return sb.toString();
}