// 去除字符串内的相邻的重复字符,例如:aabdaaadesff,最后结果abdadesf
NSMutableString *str =[NSMutableString stringWithFormat: @"IIII''mm aalleexxxxxxxxiinnhhoo"];
NSInteger i = 0;
while (i < [str length] - 1) {
if ([str characterAtIndex:i] == [str characterAtIndex:i+1]) {
[str deleteCharactersInRange:NSMakeRange(i, 1)];
}else{
i++;
}
}
NSLog(@"%@",str);