예제 #1
0
 public static bool IsRegion(string s)
 {
     // region        = 2ALPHA              ; ISO 3166-1 code
     //               / 3DIGIT              ; UN M.49 code
     return(((s.Length == 2) && AsciiUtil.IsAlpha(s)) ||
            ((s.Length == 3) && AsciiUtil.IsNumeric(s)));
 }
예제 #2
0
        public static bool IsVariant(string s)
        {
            // variant       = 5*8alphanum         ; registered variants
            //               / (DIGIT 3alphanum)
            int len = s.Length;

            if (len >= 5 && len <= 8)
            {
                return(AsciiUtil.IsAlphaNumericString(s));
            }
            if (len == 4)
            {
                return(AsciiUtil.IsNumeric(s[0]) &&
                       AsciiUtil.IsAlphaNumeric(s[1]) &&
                       AsciiUtil.IsAlphaNumeric(s[2]) &&
                       AsciiUtil.IsAlphaNumeric(s[3]));
            }
            return(false);
        }