Ejemplo n.º 1
0
        public override StandardStruct GetStandard(string fullname)
        {
            fullname = TextProcessor.ReplaceUnderlineCharBySpaceCharacter(fullname);
            Regex regex = new Regex(base.Rule);
            Match match = regex.Match(fullname);

            if (match.Success)
            {
                string prefix = match.Groups[1].Value;

                string type;
                string markString = match.Groups[2].Value.Trim().ToUpper();
                if (markString.Length > 0 && markString.Last() == 'T')
                {
                    type = "/T";
                }
                else if (markString.Length > 0 && markString.Last() == 'Z')
                {
                    type = "/Z";
                }
                else
                {
                    type = String.Empty;
                }

                string code = match.Groups[3].Value;
                int    year = Int32.Parse(match.Groups[4].Value);
                string name = regex.Replace(fullname, String.Empty).Trim();

                DataVerification.CheckYear(year);

                ChinaStandardStruct standardInfo = new ChinaStandardStruct(prefix, type, code, year, name);

                return(standardInfo);
            }

            return(null);
        }
        public override StandardStruct GetStandard(string fullname)
        {
            fullname = TextProcessor.ReplaceUnderlineCharBySpaceCharacter(fullname);
            Regex regex = new Regex(base.Rule);
            Match match = regex.Match(fullname);

            if (match.Success)
            {
                string prefix = match.Groups[1].Value;
                string mark   = string.Empty;
                string code   = match.Groups[2].Value;
                int    year   = Int32.Parse(match.Groups[3].Value);
                string name   = regex.Replace(fullname, String.Empty).Trim();

                DataVerification.CheckYear(year);

                ChinaStandardStruct standardInfo = new ChinaStandardStruct(prefix, mark, code, year, name);

                return(standardInfo);
            }

            return(null);
        }