NSString过滤字符串stringByTrimmingCharactersInSet

NSCharacterSet *set = [NSCharacterSet characterSetWithCharactersInString:@"@/:;()¥「」"、[]{}#%-*+=_\\|~<>$€^•'@#$%^&*()_+'\""];
NSString *trimmedString = [string stringByTrimmingCharactersInSet:set];

NSString *temptext = [messageTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; //去除空格
NSString *text = [temptext stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; //去除Tab,Enter,Blank




你可能感兴趣的:(NSString过滤字符串stringByTrimmingCharactersInSet)