Esempio n. 1
0
        private static string PreValidateHandling(string input, TelephoneOptions options)
        {
            if (options == null)
            {
                options = TelephoneOptions.Default;
            }

            input = TelephoneUtility.PreProcessingHandling(input, options);

            return(input);
        }
Esempio n. 2
0
        /// <summary>
        /// Validations only the signatures of the phone number
        /// </summary>
        /// <param name="phoneNumber"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static bool PhoneNumberValidateFormat(string phoneNumber, TelephoneOptions options = null)
        {
            phoneNumber = PreValidateHandling(phoneNumber, options);

            if (!TelephoneUtility.CheckOpenCloseCharacter(phoneNumber, new List <OpenClose>
            {
                new OpenClose('(', ')'),
                new OpenClose('[', ']')
            }))
            {
                return(false);
            }

            if (RegexPhoneNumberBelow3Digit.IsMatch(phoneNumber))
            {
                return(true);
            }

            return(RegexPhoneNumber.IsMatch(phoneNumber));
        }