Changeset 415
- Timestamp:
- 06/25/09 15:23:17 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
apps/iphone/superbook/trunk/Classes/LocateThem_ViewController.m
r414 r415 242 242 } 243 243 244 #pragma mark ---- UISearchBar delegate and keyboard methods methods----244 #pragma mark ---- UISearchBar delegate and keyboard methods ---- 245 245 246 246 - (void)keyboardWillShow:(NSNotification*)aNotification { … … 294 294 if ([telSearch.text length] == 0) 295 295 return; 296 // TODO: should make this faster by parsing the string char-by-char in C297 296 if ([telSearch.text hasPrefix:@"http"]) { 298 297 telSearch.text = [telSearch.text stringByReplacingOccurrencesOfString:@"http://" withString:@""]; … … 302 301 telSearch.text = [telSearch.text substringFromIndex:[@"www." length]]; 303 302 } 304 if ([telSearch.text hasSuffix:@".tel"]) { 303 if ([telSearch.text hasPrefix:@"+"]) { 304 // Check if it's a phone number, try the sip version 305 BOOL isValidNumber = YES; 306 NSMutableString *enumStr = [NSMutableString stringWithCapacity:30]; 307 NSRange prefixR = NSMakeRange(0, 0); 308 for (int i = 1; i < [telSearch.text length]; i++) { 309 unichar aChar = [telSearch.text characterAtIndex:i]; 310 if ((aChar < 47) || (aChar > 58)) { // Not in range of Unicode digits 0-9 311 isValidNumber = NO; 312 break; 313 } 314 [enumStr replaceCharactersInRange:prefixR withString:[NSString stringWithFormat:@"%c.", aChar]]; 315 } 316 if (isValidNumber) { 317 [enumStr appendString:@"e164.arpa"]; 318 telSearch.text = enumStr; 319 } 320 } else if ([telSearch.text hasSuffix:@".tel"]) { 305 321 // .tel domain, do nothing 306 322 } else if ([telSearch.text hasSuffix:@".e164.arpa"]) {








