Skip to content

Instantly share code, notes, and snippets.

@piaoapiao
Created August 13, 2012 08:30
Show Gist options
  • Save piaoapiao/3338250 to your computer and use it in GitHub Desktop.
Save piaoapiao/3338250 to your computer and use it in GitHub Desktop.
replace iphone Number
NSString *str =@"123(3 24) +8678";
NSString *result = [str stringByReplacingOccurrencesOfString:@"(" withString:@" "];
result = [result stringByReplacingOccurrencesOfString:@")" withString:@" "];
result = [result stringByReplacingOccurrencesOfString:@"+86" withString:@" "];
result = [result stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
result = [result stringByReplacingOccurrencesOfString:@" " withString:@""];
NSLog(@"result:%@",result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment