文章目录
  1. 1. iOS正则表达式代码片断

iOS正则表达式代码片断

NSRegularExpression *regularexpression =
[[
NSRegularExpressionalloc]

                                             
initWithPattern: “^0{0,1}(13[0-9]|15[0-9]|153|156|18[6-9])[0-9]{8}$“

                                              options:NSRegularExpressionCaseInsensitive

                                              error:nil];

    NSUInteger numberofMatch =
[regularexpression numberOfMatchesInString:_contactPersonMobile

                                                                  options:NSMatchingReportProgress

                                                                   
range:NSMakeRange(0, _contactPersonMobile.length)];

    if (numberofMatch <= 0) {

        [selfshowAlertMessage: 联系人手机号格式错误 dismissAfterDelay:kDismissAlertDelay];

        return NO;

\

    }

\

\

//    CGFloat width = self.payTypeDescLable.frame.size.width;

//    CGFloat actualWidth = 155;

//    if (width > actualWidth) {

//        CAKeyframeAnimation* animation = [CAKeyframeAnimation
animationWithKeyPath: “position.x”];

//        CGFloat totalTime = (width - actualWidth)/25 + 3;

//        animation.duration = totalTime;

//        animation.fillMode = kCAFillModeForwards;

//        animation.values = [NSArray arrayWithObjects:[NSNumber
numberWithFloat:200],

//                            [NSNumber numberWithFloat:180],

//                            [NSNumber numberWithFloat:200],

//                            [NSNumber numberWithFloat:180],

//                            [NSNumber numberWithFloat:200], nil];

//        animation.keyTimes = [NSArray arrayWithObjects:[NSNumber
numberWithFloat:0],

//                              [NSNumber
numberWithFloat:1/totalTime],

//                              [NSNumber numberWithFloat:1/totalTime +
((totalTime - 2) / (totalTime * 2))],

//                              [NSNumber numberWithFloat:2/totalTime +
((totalTime - 2) / (totalTime * 2))],

//                              [NSNumber numberWithFloat:1.5], nil];

//        animation.removedOnCompletion = NO;

//        animation.repeatCount = HUGE_VALF;  //forever

//        [self.payTypeDescLable.layer addAnimation:animation
forKey:nil];

//   
}
\

\

文章目录
  1. 1. iOS正则表达式代码片断