手機(jī)號(hào)現(xiàn)在出現(xiàn)了很多奇葩號(hào)碼,因此設(shè)置的時(shí)候最好多考慮添加一些,因?yàn)槲揖陀龅竭^,前一個(gè)程序員第一個(gè)版本沒有添加正則,第二個(gè)版本要求添加正則,而對(duì)方的手機(jī)號(hào)正好不在正則之內(nèi),客戶要訂購商品然后因?yàn)檎齽t問題無法登陸因此被投訴,前一個(gè)程序員離職了,我剛?cè)肼氈苯颖冲?img alt="哭" src="http://s1.VeVb.com/20170227/uoecyyanwae29.gif">
- (NSTextCheckingResult *)checkCellPhoneNum:(NSString *)cellPhoneNum{ NSString *patternCellphone = @"^((13[0-9])|(14[0-9])|(15[0-9])|(17[0-9])|(18[0-9]))//d{8}$"; NSRegularExPRession *regExcellphone = [NSRegularExpression regularExpressionWithPattern:patternCellphone options:0 error:nil]; NSTextCheckingResult *isMatchCellphone = [regexCellphone firstMatchInString:cellPhoneNum options:0 range:NSMakeRange(0, [cellPhoneNum length])]; return isMatchCellphone;}
調(diào)取的時(shí)候方法
if([self checkCellPhoneNum:textNumber.text] != nil){
}
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注