#pragma mark ----------- ---------去除字符串中的标点符号
-(NSString*) stringDeleteString:(NSString*)str
{
NSMutableString*str1 = [NSMutableStringstringWithString:str];
for(inti =0; i < str1.length; i++)
{
unicharc = [str1characterAtIndex:i];
NSRangerange =NSMakeRange(i,1);
if(c =='"'|| c =='.'|| c ==','|| c ==' '|| c =='\n'|| c =='('|| c ==')'|| c =='{'|| c =='}')//此处可以是任何字符
{
[str1deleteCharactersInRange:range];
--i;
}
}
NSString*newstr = [NSStringstringWithString:str1];
returnnewstr;
}
网友评论