判断是否全数字

/**

 是否全数字

 

 @param string

 @return 

 */

- (BOOL)isAllNum:(NSString *)string{

    unichar c;

    for (int i=0; i<string.length; i++) {

        c=[string characterAtIndex:i];

        if (!isdigit(c)) {

            return NO;

        }

    }

    return YES;

}

posted @ 2017-01-23 10:54  Panthera-leo  阅读(132)  评论(0编辑  收藏  举报