用正則表達式刪除字符串中的數字,能實現嗎?
string = @"hb4hbb543bt3g";
刪完之後:hbhbbbtg
NSString * val = @"hb4hbb543bt3g";
NSString * strippedNumber = [val stringByReplacingOccurrencesOfString:@"[^0-9]" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, [val length])];
NSLog(@"%@", strippedNumber);
輸出:-hbhbbbtg