首页 > 其他分享 >Apple开发_正则表达式相关

Apple开发_正则表达式相关

时间:2024-08-05 16:05:29浏览次数:8  
标签:return Apple &# 正则表达式 value NSString 开发 gc BOOL

  • NSString+Regex.h

#import <Foundation/Foundation.h>

// 正则表达式相关
@interface NSString (Regex)

// 邮箱验证
- (BOOL)is_Email;

// 手机号码验证
- (BOOL)is_Phone_Num;

// 车牌号验证
- (BOOL)is_Car_No;

// 网址验证
- (BOOL)is_Url;

// 邮政编码
- (BOOL)is_Postal_Code;

// 纯汉字
- (BOOL)is_Chinese;

// 是否符合IP格式, xxx.xxx.xxx.xxx
- (BOOL)is_Valid_IP;

// 身份证验证 refer to http://blog.csdn.net/afyzgh/article/details/16965107
- (BOOL)is_IdCard_Num;

/**
 * @brief 是否符合最小长度、最长长度, 是否包含中文, 数字, 字母, 其他字符, 首字母是否可以为数字
 * @param minLenth 账号最小长度
 * @param maxLenth 账号最长长度
 * @param containChinese 是否包含中文
 * @param containDigtal 包含数字
 * @param containLetter 包含字母
 * @param containOtherCharacter 其他字符
 * @param first_cannot_be_digtal 首字母不能为数字
 * @return 正则验证成功返回YES, 否则返回NO
 */
- (BOOL)isValidWithMinLenth:(NSInteger)min_lenth
                   maxLenth:(NSInteger)max_lenth
             containChinese:(BOOL)contain_chinese
              containDigtal:(BOOL)contain_digtal
              containLetter:(BOOL)contain_letter
      containOtherCharacter:(NSString *)contain_other_character
        firstCannotBeDigtal:(BOOL)first_cannot_be_digtal;

// 去掉两端空格和换行符
- (NSString *)strip;

// 去掉html格式
- (NSString *)remove_Html_Format;

// 工商税号
- (BOOL)is_Tax_No;

@end
  • NSString+Regex.m

#import "NSString+Regex.h"

@implementation NSString (Regex)

// 邮箱验证
- (BOOL)is_Email {
    NSString *email_regex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
    NSPredicate *email_test = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", email_regex];
    return [email_test evaluateWithObject:self];
}

// 手机号码验证
- (BOOL)is_Phone_Num {
    // 手机号以13, 14, 15, 17, 18, 19开头, 八个 \d 数字字符
    NSString *phone_regex = @"^(13[0-9]|14[5-9]|15[012356789]|166|17[0-8]|18[0-9]|19[0-9])[0-9]{8}$";
    NSPredicate *phone_test = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phone_regex];
    return [phone_test evaluateWithObject:self];
}

// 车牌号验证
- (BOOL)is_Car_No {
    NSString *car_regex = @"^[A-Za-z]{1}[A-Za-z_0-9]{5}$";
    NSPredicate *car_test = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", car_regex];
    return [car_test evaluateWithObject:self];
}

// 网址验证
- (BOOL)is_Url {
    NSString *regex = @"^((http)|(https))+:[^\\s]+\\.[^\\s]*$";
    
    NSPredicate *gc_pre = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
    return [gc_pre evaluateWithObject:self];
}

// 邮政编码
- (BOOL)is_Postal_Code {
    NSString *phone_regex = @"^[0-8]\\d{5}(?!\\d)$";
    NSPredicate *phone_test = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phone_regex];
    return [phone_test evaluateWithObject:self];
}

// 纯汉字
- (BOOL)is_Chinese {
    NSString *phone_regex = @"^[\u4e00-\u9fa5]+$";
    NSPredicate *phone_test = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phone_regex];
    return [phone_test evaluateWithObject:self];
}

- (BOOL)is_Valid_IP {
    NSString *regex = [NSString stringWithFormat:@"^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$"];
    NSPredicate *gc_pre = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
    BOOL gc_rc = [gc_pre evaluateWithObject:self];
   
    if (gc_rc) {
        NSArray *componds_a = [self componentsSeparatedByString:@","];
       
        BOOL gc_v = YES;
        for (NSString *gc_s in componds_a) {
            if (gc_s.integerValue > 255) {
                gc_v = NO;
                break;
            }
        }
       
        return gc_v;
    }
   
    return NO;
}

// 身份证验证 refer to http://blog.csdn.net/afyzgh/article/details/16965107
- (BOOL)is_IdCard_Num {
    NSString *gc_value = [self copy];
    gc_value = [gc_value stringByReplacingOccurrencesOfString:@"X" withString:@"x"];
    gc_value = [gc_value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    int length = 0;
    if (!gc_value) {
        return NO;
    }
    else {
        length = (int)gc_value.length;
        if (length != 15 && length != 18) {
            return NO;
        }
    }
    // 省份代码
    NSArray *areas_array = @[@"11", @"12", @"13", @"14", @"15", @"21", @"22", @"23", @"31", @"32", @"33", @"34", @"35", @"36", @"37", @"41", @"42", @"43", @"44", @"45", @"46", @"50", @"51", @"52", @"53", @"54", @"61", @"62", @"63", @"64", @"65", @"71", @"81", @"82", @"91"];
    NSString *value_start2 = [gc_value substringToIndex:2];
    BOOL area_flag = NO;
    for (NSString *area_code in areas_array) {
        if ([area_code isEqualToString:value_start2]) {
            area_flag = YES;
            break;
        }
    }
    if (!area_flag) {
        return NO;
    }
    NSRegularExpression *regularExpression;
    NSUInteger numberofMatch;
    int gc_year = 0;
    switch (length) {
        case 15:
            gc_year = [gc_value substringWithRange:NSMakeRange(6, 2)].intValue + 1900;
            if (gc_year % 4 == 0 || (gc_year % 100 == 0 && gc_year % 4 == 0)) {
                // 测试出生日期的合法性
                regularExpression = [[NSRegularExpression alloc] initWithPattern:@"^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$" options:NSRegularExpressionCaseInsensitive error:nil];
            }
            else {
                // 测试出生日期的合法性
                regularExpression = [[NSRegularExpression alloc] initWithPattern:@"^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$" options:NSRegularExpressionCaseInsensitive error:nil];
            }
            numberofMatch = [regularExpression numberOfMatchesInString:gc_value options:NSMatchingReportProgress range:NSMakeRange(0, gc_value.length)];
            if (numberofMatch > 0) {
                return YES;
            }
            else {
                return NO;
            }
        case 18:
            gc_year = [gc_value substringWithRange:NSMakeRange(6, 4)].intValue;
            if (gc_year % 4 == 0 || (gc_year % 100 == 0 && gc_year % 4 == 0)) {
                // 测试出生日期的合法性
                regularExpression = [[NSRegularExpression alloc] initWithPattern:@"^[1-9][0-9]{5}19|20[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$"options:NSRegularExpressionCaseInsensitive error:nil];
               
            }
            else {
                // 测试出生日期的合法性
                regularExpression = [[NSRegularExpression alloc] initWithPattern:@"^[1-9][0-9]{5}19|20[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$"
                                                                        
                                                                         options:NSRegularExpressionCaseInsensitive error:nil];
            }
            numberofMatch = [regularExpression numberOfMatchesInString:gc_value options:NSMatchingReportProgress range:NSMakeRange(0, gc_value.length)];
            if (numberofMatch > 0) {
                int gc_s = ([gc_value substringWithRange:NSMakeRange(0, 1)].intValue + [gc_value substringWithRange:NSMakeRange(10, 1)].intValue) * 7 + ([gc_value substringWithRange:NSMakeRange(1, 1)].intValue + [gc_value substringWithRange:NSMakeRange(11, 1)].intValue) * 9 + ([gc_value substringWithRange:NSMakeRange(2, 1)].intValue + [gc_value substringWithRange:NSMakeRange(12, 1)].intValue) * 10 + ([gc_value substringWithRange:NSMakeRange(3, 1)].intValue + [gc_value substringWithRange:NSMakeRange(13, 1)].intValue) * 5 + ([gc_value substringWithRange:NSMakeRange(4, 1)].intValue + [gc_value substringWithRange:NSMakeRange(14, 1)].intValue) * 8 + ([gc_value substringWithRange:NSMakeRange(5, 1)].intValue + [gc_value substringWithRange:NSMakeRange(15, 1)].intValue) * 4 + ([gc_value substringWithRange:NSMakeRange(6, 1)].intValue + [gc_value substringWithRange:NSMakeRange(16, 1)].intValue) * 2 + [gc_value substringWithRange:NSMakeRange(7, 1)].intValue * 1 + [gc_value substringWithRange:NSMakeRange(8, 1)].intValue * 6 + [gc_value substringWithRange:NSMakeRange(9, 1)].intValue * 3;
                int gc_y = gc_s % 11;
                NSString *gc_m = @"F";
                NSString *gc_jym = @"10X98765432";
                // 判断校验位
                gc_m = [gc_jym substringWithRange:NSMakeRange(gc_y, 1)];
                if ([gc_m isEqualToString:[[gc_value substringWithRange:NSMakeRange(17, 1)] uppercaseString]]) {
                    // 检测ID的校验位
                    return YES;
                }
                else {
                    return NO;
                }
            }
            else {
                return NO;
            }
           
        default:
            return NO;
    }
    return NO;
}

/**
 * @brief 是否符合最小长度、最长长度, 是否包含中文, 数字, 字母, 其他字符, 首字母是否可以为数字
 * @param minLenth 账号最小长度
 * @param maxLenth 账号最长长度
 * @param containChinese 是否包含中文
 * @param containDigtal 包含数字
 * @param containLetter 包含字母
 * @param containOtherCharacter 其他字符
 * @param first_cannot_be_digtal 首字母不能为数字
 * @return 正则验证成功返回YES, 否则返回NO
 */
- (BOOL)isValidWithMinLenth:(NSInteger)min_lenth
                   maxLenth:(NSInteger)max_lenth
             containChinese:(BOOL)contain_chinese
              containDigtal:(BOOL)contain_digtal
              containLetter:(BOOL)contain_letter
      containOtherCharacter:(NSString *)contain_other_character
        firstCannotBeDigtal:(BOOL)first_cannot_be_digtal {
    BOOL gc_rc = YES;
    if (first_cannot_be_digtal) {
        NSString *regex = @"^[0-9]+.*";
        NSPredicate *gc_pre = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
        gc_rc = [gc_pre evaluateWithObject:self];
        if (gc_rc) {
            return NO;
        }
    }
   
    NSString *gc_hanzi = contain_chinese ? @"\u4e00-\u9fa5" : @"";
    NSString *digtal_regex = contain_digtal ? @"0-9" : @"";
    NSString *containOtherCharacterRegex = contain_other_character ? contain_other_character : @"";
    NSString *character_regex = [NSString stringWithFormat:@"[%@A-Za-z%@%@]", gc_hanzi, digtal_regex, containOtherCharacterRegex];
    NSString *regex = [NSString stringWithFormat:@"%@{%@,%@}", character_regex, @(min_lenth), @(max_lenth)];
    NSPredicate *gc_pre = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
    return [gc_pre evaluateWithObject:self];
}

// 去掉两端空格和换行符
- (NSString *)strip {
    return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
}

// 去掉html格式
- (NSString *)remove_Html_Format {
    NSString *gc_str = [NSString stringWithFormat:@"%@", self];
   
    NSError *error;
    NSRegularExpression *gc_regex = [NSRegularExpression regularExpressionWithPattern:@"<[^>]*>" options:NSRegularExpressionCaseInsensitive error:&error];
    if (!error) {
        gc_str = [gc_regex stringByReplacingMatchesInString:gc_str options:0 range:NSMakeRange(0, gc_str.length) withTemplate:@"$2$1"];
    }
    else {
        NSLog(@"%@", error);
    }
   
    NSArray *html_code = @[
                           @"\"", @"'", @"&", @"<", @">", 
                           @"", @"¡", @"¢", @"£", @"¤", 
                           @"¥", @"¦", @"§", @"¨", @"©", 
                           @"ª", @"«", @"¬", @"", @"®", 
                           @"¯", @"°", @"±", @"²", @"³", 
                          
                           @"´", @"µ", @"¶", @"·", @"¸", 
                           @"¹", @"º", @"»", @"¼", @"½", 
                           @"¾", @"¿", @"×", @"÷", @"À", 
                           @"Á", @"Â", @"Ã", @"Ä", @"Å", 
                           @"Æ", @"Ç", @"È", @"É", @"Ê", 
                          
                           @"Ë", @"Ì", @"Í", @"Î", @"Ï", 
                           @"Ð", @"Ñ", @"Ò", @"Ó", @"Ô", 
                           @"Õ", @"Ö", @"Ø", @"Ù", @"Ú", 
                           @"Û", @"Ü", @"Ý", @"Þ", @"ß", 
                           @"à", @"á", @"â", @"ã", @"ä", 
                          
                           @"å", @"æ", @"ç", @"è", @"é", 
                           @"ê", @"ë", @"ì", @"í", @"î", 
                           @"ï", @"ð", @"ñ", @"ò", @"ó", 
                           @"ô", @"õ", @"ö", @"ø", @"ù", 
                           @"ú", @"û", @"ü", @"ý", @"þ", 
                          
                           @"ÿ", @"∀", @"∂", @"∃", @"∅", 
                           @"∇", @"∈", @"∉", @"∋", @"∏", 
                           @"∑", @"−", @"∗", @"√", @"∝", 
                           @"∞", @"∠", @"∧", @"∨", @"∩", 
                           @"∪", @"∫", @"∴", @"∼", @"≅", 
                          
                           @"≈", @"≠", @"≡", @"≤", @"≥", 
                           @"⊂", @"⊃", @"⊄", @"⊆", @"⊇", 
                           @"⊕", @"⊗", @"⊥", @"⋅", @"Α", 
                           @"Β", @"Γ", @"Δ", @"Ε", @"Ζ", 
                           @"Η", @"Θ", @"Ι", @"Κ", @"Λ", 
                          
                           @"Μ", @"Ν", @"Ξ", @"Ο", @"Π", 
                           @"Ρ", @"Σ", @"Τ", @"Υ", @"Φ", 
                           @"Χ", @"Ψ", @"Ω", @"α", @"β", 
                           @"γ", @"δ", @"ε", @"ζ", @"η", 
                           @"θ", @"ι", @"κ", @"λ", @"μ", 
                          
                           @"ν", @"ξ", @"ο", @"π", @"ρ", 
                           @"ς", @"σ", @"τ", @"υ", @"φ", 
                           @"χ", @"ψ", @"ω", @"ϑ", @"ϒ", 
                           @"ϖ", @"Œ", @"œ", @"Š", @"š", 
                           @"Ÿ", @"ƒ", @"ˆ", @"˜", @"", 
                          
                           @"", @"", @"", @"", @"", 
                           @"", @"–", @"—", @"‘", @"’", 
                           @"‚", @"“", @"”", @"„", @"†", 
                           @"‡", @"•", @"…", @"‰", @"′", 
                           @"″", @"‹", @"›", @"‾", @"€", 
                          
                           @"™", @"←", @"↑", @"→", @"↓", 
                           @"↔", @"↵", @"⌈", @"⌉", @"⌊", 
                           @"⌋", @"◊", @"♠", @"♣", @"♥", 
                           @"♦", 
                           ];
    NSArray *gc_code = @[
                      @"&quot;", @"&apos;", @"&amp;", @"&lt;", @"&gt;", 
                      @"&nbsp;", @"&iexcl;", @"&cent;", @"&pound;", @"&curren;", 
                      @"&yen;", @"&brvbar;", @"&sect;", @"&uml;", @"&copy;", 
                      @"&ordf;", @"&laquo;", @"&not;", @"&shy;", @"&reg;", 
                      @"&macr;", @"&deg;", @"&plusmn;", @"&sup2;", @"&sup3;", 
                     
                      @"&acute;", @"&micro;", @"&para;", @"&middot;", @"&cedil;", 
                      @"&sup1;", @"&ordm;", @"&raquo;", @"&frac14;", @"&frac12;", 
                      @"&frac34;", @"&iquest;", @"&times;", @"&divide;", @"&Agrave;", 
                      @"&Aacute;", @"&Acirc;", @"&Atilde;", @"&Auml;", @"&Aring;", 
                      @"&AElig;", @"&Ccedil;", @"&Egrave;", @"&Eacute;", @"&Ecirc;", 
                     
                      @"&Euml;", @"&Igrave;", @"&Iacute;", @"&Icirc;", @"&Iuml;", 
                      @"&ETH;", @"&Ntilde;", @"&Ograve;", @"&Oacute;", @"&Ocirc;", 
                      @"&Otilde;", @"&Ouml;", @"&Oslash;", @"&Ugrave;", @"&Uacute;", 
                      @"&Ucirc;", @"&Uuml;", @"&Yacute;", @"&THORN;", @"&szlig;", 
                      @"&agrave;", @"&aacute;", @"&acirc;", @"&atilde;", @"&auml;", 
                     
                      @"&aring;", @"&aelig;", @"&ccedil;", @"&egrave;", @"&eacute;", 
                      @"&ecirc;", @"&euml;", @"&igrave;", @"&iacute;", @"&icirc;", 
                      @"&iuml;", @"&eth;", @"&ntilde;", @"&ograve;", @"&oacute;", 
                      @"&ocirc;", @"&otilde;", @"&ouml;", @"&oslash;", @"&ugrave;", 
                      @"&uacute;", @"&ucirc;", @"&uuml;", @"&yacute;", @"&thorn;", 
                     
                      @"&yuml;", @"&forall;", @"&part;", @"&exists;", @"&empty;", 
                      @"&nabla;", @"&isin;", @"&notin;", @"&ni;", @"&prod;", 
                      @"&sum;", @"&minus;", @"&lowast;", @"&radic;", @"&prop;", 
                      @"&infin;", @"&ang;", @"&and;", @"&or;", @"&cap;", 
                      @"&cup;", @"&int;", @"&there4;", @"&sim;", @"&cong;", 
                     
                      @"&asymp;", @"&ne;", @"&equiv;", @"&le;", @"&ge;", 
                      @"&sub;", @"&sup;", @"&nsub;", @"&sube;", @"&supe;", 
                      @"&oplus;", @"&otimes;", @"&perp;", @"&sdot;", @"&Alpha;", 
                      @"&Beta;", @"&Gamma;", @"&Delta;", @"&Epsilon;", @"&Zeta;", 
                      @"&Eta;", @"&Theta;", @"&Iota;", @"&Kappa;", @"&Lambda;", 
                     
                      @"&Mu;", @"&Nu;", @"&Xi;", @"&Omicron;", @"&Pi;", 
                      @"&Rho;", @"&Sigma;", @"&Tau;", @"&Upsilon;", @"&Phi;", 
                      @"&Chi;", @"&Psi;", @"&Omega;", @"&alpha;", @"&beta;", 
                      @"&gamma;", @"&delta;", @"&epsilon;", @"&zeta;", @"&eta;", 
                      @"&theta;", @"&iota;", @"&kappa;", @"&lambda;", @"&mu;", 
                     
                      @"&nu;", @"&xi;", @"&omicron;", @"&pi;", @"&rho;", 
                      @"&sigmaf;", @"&sigma;", @"&tau;", @"&upsilon;", @"&phi;", 
                      @"&chi;", @"&psi;", @"&omega;", @"&thetasym;", @"&upsih;", 
                      @"&piv;", @"&OElig;", @"&oelig;", @"&Scaron;", @"&scaron;", 
                      @"&Yuml;", @"&fnof;", @"&circ;", @"&tilde;", @"&ensp;", 
                     
                      @"&emsp;", @"&thinsp;", @"&zwnj;", @"&zwj;", @"&lrm;", 
                      @"&rlm;", @"&ndash;", @"&mdash;", @"&lsquo;", @"&rsquo;", 
                      @"&sbquo;", @"&ldquo;", @"&rdquo;", @"&bdquo;", @"&dagger;", 
                      @"&Dagger;", @"&bull;", @"&hellip;", @"&permil;", @"&prime;", 
                      @"&Prime;", @"&lsaquo;", @"&rsaquo;", @"&oline;", @"&euro;", 
                     
                      @"&trade;", @"&larr;", @"&uarr;", @"&rarr;", @"&darr;", 
                      @"&harr;", @"&crarr;", @"&lceil;", @"&rceil;", @"&lfloor;", 
                      @"&rfloor;", @"&loz;", @"&spades;", @"&clubs;", @"&hearts;", 
                      @"&diams;", 
                      ];
//    NSArray *code_hex = @[
//                          @"&#34;", @"&#39;", @"&#38;", @"&#60;", @"&#62;", 
//                          @"&#160;", @"&#161;", @"&#162;", @"&#163;", @"&#164;", 
//                          @"&#165;", @"&#166;", @"&#167;", @"&#168;", @"&#169;", 
//                          @"&#170;", @"&#171;", @"&#172;", @"&#173;", @"&#174;", 
//                          @"&#175;", @"&#176;", @"&#177;", @"&#178;", @"&#179;", 
//                         
//                          @"&#180;", @"&#181;", @"&#182;", @"&#183;", @"&#184;", 
//                          @"&#185;", @"&#186;", @"&#187;", @"&#188;", @"&#189;", 
//                          @"&#190;", @"&#191;", @"&#215;", @"&#247;", @"&#192;", 
//                          @"&#193;", @"&#194;", @"&#195;", @"&#196;", @"&#197;", 
//                          @"&#198;", @"&#199;", @"&#200;", @"&#201;", @"&#202;", 
//                         
//                          @"&#203;", @"&#204;", @"&#205;", @"&#206;", @"&#207;", 
//                          @"&#208;", @"&#209;", @"&#210;", @"&#211;", @"&#212;", 
//                          @"&#213;", @"&#214;", @"&#216;", @"&#217;", @"&#218;", 
//                          @"&#219;", @"&#220;", @"&#221;", @"&#222;", @"&#223;", 
//                          @"&#224;", @"&#225;", @"&#226;", @"&#227;", @"&#228;", 
//                         
//                          @"&#229;", @"&#230;", @"&#231;", @"&#232;", @"&#233;", 
//                          @"&#234;", @"&#235;", @"&#236;", @"&#237;", @"&#238;", 
//                          @"&#239;", @"&#240;", @"&#241;", @"&#242;", @"&#243;", 
//                          @"&#244;", @"&#245;", @"&#246;", @"&#248;", @"&#249;", 
//                          @"&#250;", @"&#251;", @"&#252;", @"&#253;", @"&#254;", 
//                         
//                          @"&#255;", @"&#8704;", @"&#8706;", @"&#8707;", @"&#8709;", 
//                          @"&#8711;", @"&#8712;", @"&#8713;", @"&#8715;", @"&#8719;", 
//                          @"&#8721;", @"&#8722;", @"&#8727;", @"&#8730;", @"&#8733;", 
//                          @"&#8734;", @"&#8736;", @"&#8743;", @"&#8744;", @"&#8745;", 
//                          @"&#8746;", @"&#8747;", @"&#8756;", @"&#8764;", @"&#8773;", 
//                         
//                          @"&#8776;", @"&#8800;", @"&#8801;", @"&#8804;", @"&#8805;", 
//                          @"&#8834;", @"&#8835;", @"&#8836;", @"&#8838;", @"&#8839;", 
//                          @"&#8853;", @"&#8855;", @"&#8869;", @"&#8901;", @"&#913;", 
//                          @"&#914;", @"&#915;", @"&#916;", @"&#917;", @"&#918;", 
//                          @"&#919;", @"&#920;", @"&#921;", @"&#922;", @"&#923;", 
//                         
//                          @"&#924;", @"&#925;", @"&#926;", @"&#927;", @"&#928;", 
//                          @"&#929;", @"&#931;", @"&#932;", @"&#933;", @"&#934;", 
//                          @"&#935;", @"&#936;", @"&#937;", @"&#945;", @"&#946;", 
//                          @"&#947;", @"&#948;", @"&#949;", @"&#950;", @"&#951;", 
//                          @"&#952;", @"&#953;", @"&#954;", @"&#923;", @"&#956;", 
//                         
//                          @"&#925;", @"&#958;", @"&#959;", @"&#960;", @"&#961;", 
//                          @"&#962;", @"&#963;", @"&#964;", @"&#965;", @"&#966;", 
//                          @"&#967;", @"&#968;", @"&#969;", @"&#977;", @"&#978;", 
//                          @"&#982;", @"&#338;", @"&#339;", @"&#352;", @"&#353;", 
//                          @"&#376;", @"&#402;", @"&#710;", @"&#732;", @"&#8194;", 
//                         
//                          @"&#8195;", @"&#8201;", @"&#8204;", @"&#8205;", @"&#8206;", 
//                          @"&#8207;", @"&#8211;", @"&#8212;", @"&#8216;", @"&#8217;", 
//                          @"&#8218;", @"&#8220;", @"&#8221;", @"&#8222;", @"&#8224;", 
//                          @"&#8225;", @"&#8226;", @"&#8230;", @"&#8240;", @"&#8242;", 
//                          @"&#8243;", @"&#8249;", @"&#8250;", @"&#8254;", @"&#8364;", 
//                         
//                          @"&#8482;", @"&#8592;", @"&#8593;", @"&#8594;", @"&#8595;", 
//                          @"&#8596;", @"&#8629;", @"&#8968;", @"&#8969;", @"&#8970;", 
//                          @"&#8971;", @"&#9674;", @"&#9824;", @"&#9827;", @"&#9829;", 
//                          @"&#9830;", 
//                          ];
   
    NSInteger gc_idx = 0;
    for (NSString *gc_obj in gc_code) {
        gc_str = [gc_str stringByReplacingOccurrencesOfString:(NSString *)gc_obj withString:html_code[gc_idx]];
        gc_idx ++;
    }
    return gc_str;
}

// 工商税号
- (BOOL)is_Tax_No {
    NSString *emailRegex = @"[0-9]\\d{13}([0-9]|X)$";
    NSPredicate *email_test = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
    return [email_test evaluateWithObject:self];
}

@end

标签:return,Apple,&#,正则表达式,value,NSString,开发,gc,BOOL
From: https://www.cnblogs.com/CH520/p/18343427

相关文章

  • 结构开发笔记(一):外壳IP防水等级与IP防水铝壳体初步选型
    前言  做产品,需要选型外壳结构,本篇普及IP防护等级与基础铝合金外壳。 IPXX防护等级  IP等级(IngressProtectionrating)是用于描述电气设备外壳对异物(如尘埃、手指或其他固体物体)和水侵入的防护能力的国际标准。这个标准在全球范围内被广泛应用,以确保设备在各种环......
  • 介绍微软的三款工具,增加你的开发效率
    1、PowerToys它最实用的就是1、获取电脑颜色拾取器,尺寸大小测量,这个对前端或者UI方便2、直接快速打开环境变量、Host、注册表3、对桌面进行布局4、通常我们进行大容量的文件复制比如从盘符复制东西到U盘,已经关闭文件资源管理器,但是弹出U盘时依然报错使用它,右键直接解锁2、......
  • iOS开发基础148-ABM vs MDM
    详细了解AppleBusinessManager(ABM)和MobileDeviceManagement(MDM)企业在选择设备管理方案时,常常面对ABM和MDM的选择。ABM和MDM各有其独特的优点和限制,并且结合使用能带来更加灵活和强大的设备管理能力。本文将深入比较ABM和MDM的不同之处,并解释如何结合使用这两种工具以实现最优......
  • iOS开发基础147-ABM集中管理Apple设备
    AppleBusinessManager(ABM)是一种集中管理Apple设备、应用程序和内容的解决方案。它可以帮助企业简化部署和管理Apple设备。接入ABM可以让公司在设备设置、应用分发和内容管理方面更加高效和灵活。与传统的企业开发者账号(即AppleDeveloperEnterpriseProgram)和MDM(MobileDev......
  • QT-开发基础知识-全-
    QT开发基础知识(全)原文:FoundationsofQtDevelopment协议:CCBY-NC-SA4.0一、C++的Qt方式Qt是一个跨平台、图形化的应用开发工具包,使您能够在Windows、MacOSX、Linux和不同品牌的Unix上编译和运行您的应用。Qt的很大一部分致力于为一切事物提供平台中立的接口,从......
  • 【GIS开发】双非一本毕业生如何拿到武汉国企offer?面试分享
    个人经历:大家好,我是新中地特训营2307期班级的学员。在24年的春季校招上,我作为一名双非一本的应届生有幸拿到了武汉一家国企WebGIS三维开发岗的offer,9K+定额六险一金+项目奖金+13薪,薪资待遇算得上是同行里的中等偏上。圆满结束了我的求职之旅,下面我将分享一些在新中地学习的GIS......
  • Android开发_android stuido 快捷键
    Alt+回车导入包,自动修正Ctrl+N查找类Ctrl+Shift+N查找文件Ctrl+Alt+L格式化代码Ctrl+Alt+O优化导入的类和包Alt+Insert生成代码(如get,set方法,构造函数等)Ctrl+E或者Alt+Shift+C最近更改的代码Ctrl+R替换文本Ctrl+F查找文本Ctrl+Shift+Space自动补全代码......
  • 《Three.JS零基础入门教程》第一篇:搭建开发环境
    本教程由新中地GIS开发高级讲师李俊杰老师出品,由浅入深,循序渐进,深入浅出的分析web3D中的核心概念。网格模型场景相机光影动画模型加载学习Three.js对于GIS开发是有很多帮助的。Three.js是一个基于JavaScript的3D图形库,它可以在网页上创建交互式的3D图形和动画效果。......
  • VisionPro二次开发学习笔记1-创建基于QuickBuild的C#应用程序
    创建基于QuickBuild的C#应用程序使用的QuickBuild应用程序位于%VPRO_ROOT%/Samples/Programming/QuickBuild/advancedAppOne.vpp中。在继续之前,可以在QuickBuild中运行该应用程序。QuickBuild应用程序使用PatMax查找支架的“耳朵”之一,使用CogFixture工具设置图像的......
  • 正则表达式
    正则表达式一.字符通配符字符通配符是一种在多种编程语言和工具中广泛使用的特殊字符或字符序列,它们用于匹配或比较字符串时表示一组字符的模式。字符通配符可以实现模糊匹配,使得字符串处理更加灵活和高效。在Java中,字符通配符的使用主要体现在以下几个方面:1.正则表达式中的通......