Beispiel #1
0
 public static bool IsRegion(string s)
 {
     // region        = 2ALPHA              ; ISO 3166-1 code
     //               / 3DIGIT              ; UN M.49 code
     return(((s.Length == 2) && AsciiUtil.IsAlphaString(s)) ||
            ((s.Length == 3) && AsciiUtil.IsNumericString(s)));
 }
Beispiel #2
0
        //
        // Language subtag syntax checking methods
        //

        public static bool IsLanguage(string s)
        {
            // language      = 2*3ALPHA            ; shortest ISO 639 code
            //                 ["-" extlang]       ; sometimes followed by
            //                                     ;   extended language subtags
            //               / 4ALPHA              ; or reserved for future use
            //               / 5*8ALPHA            ; or registered language subtag
            return((s.Length >= 2) && (s.Length <= 8) && AsciiUtil.IsAlphaString(s));
        }
Beispiel #3
0
        public static bool IsExtensionSingleton(string s)
        {
            // singleton     = DIGIT               ; 0 - 9
            //               / %x41-57             ; A - W
            //               / %x59-5A             ; Y - Z
            //               / %x61-77             ; a - w
            //               / %x79-7A             ; y - z

            return((s.Length == 1) &&
                   AsciiUtil.IsAlphaString(s) &&
                   !AsciiUtil.CaseIgnoreMatch(PRIVATEUSE, s));
        }
Beispiel #4
0
 public static bool IsScript(String s)
 {
     // script        = 4ALPHA              ; ISO 15924 code
     return((s.Length == 4) && AsciiUtil.IsAlphaString(s));
 }
Beispiel #5
0
 public static bool IsExtlang(string s)
 {
     // extlang       = 3ALPHA              ; selected ISO 639 codes
     //                 *2("-" 3ALPHA)      ; permanently reserved
     return((s.Length == 3) && AsciiUtil.IsAlphaString(s));
 }