Пример #1
0
        /// <summary>
        /// Validates a Canadian Postal Code pattern (A3A 3A3)
        /// 18 letters+[0-9]+20 letters " " [0-9]+20 letters+[0-9]
        /// " " is optional
        /// </summary>
        public static bool validatePostalCode(string sVal)
        {
            if (string.IsNullOrEmpty(sVal))
            {
                return(true);
            }

            return(HKNumericUtilities.IsMatchRX(
                       @"[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] ?\d[ABCEGHJKLMNPRSTVWXYZ]\d", sVal));
        }
        /// <summary>
        /// Extract only digital number from the string value.
        /// </summary>
        public static string getOnlyDigitals(string sVal)
        {
            string sNewVal = "";

            for (int i = 0; i < sVal.Length; i++)
            {
                if (HKNumericUtilities.IsInteger(sVal[i].ToString()))
                {
                    sNewVal += sVal[i];
                }
            }
            return(sNewVal);
        }