Breaking News
Home / iOS / ObjectiveC / How to clean phone number string in Objective C?

How to clean phone number string in Objective C?

  1. +(NSString*) cleanPhoneNumber:(NSString*) input
  2. {
  3.     NSString *output = @"";
  4. for (int i=0; i<[input length]; i++) {
  5.     if (isdigit([input characterAtIndex:i])) {
  6.       output=   [output  stringByAppendingFormat:@"%c",[input characterAtIndex:i]];
  7.     }
  8. }
  9.    
  10.     return  output;
  11. }
[pb_builder]

Check Also

Singleton Example in Objective C?

Solution static MyManager *sharedManager = nil; +(MyManager*) sharedManager {         if (sharedManager == nil)         …

Advertisment ad adsense adlogger