コード例 #1
0
        public static string ToE164(string tn, Country.Values country)
        {
            PhoneNumber number = null;

            number = country == Country.Values.Unknown ? Parse(tn) : Parse(tn, country);

            return(number == null ? tn : PhoneNumberUtil.GetInstance().Format(number, PhoneNumberFormat.E164));
        }
コード例 #2
0
        public static CountryAlpha2.Values?CountryToAlpha2(Country.Values countryKey)
        {
            var countryId = (int)countryKey;

            if (Enum.IsDefined(typeof(CountryAlpha2.Values), countryId))
            {
                return((CountryAlpha2.Values)countryId);
            }

            return(null);
        }
コード例 #3
0
        public static PhoneNumber Parse(string tn, Country.Values country)
        {
            var countryAlpha2 = Country.CountryToAlpha2(country);

            return((countryAlpha2 != null && tn != null) ? PhoneNumberUtil.GetInstance().Parse(tn, countryAlpha2.ToString()) : null);
        }