/// <summary>
        /// Extracts the country calling code from the beginning of nationalNumber to
        /// prefixBeforeNationalNumber when they are available, and places the remaining input into
        /// nationalNumber.
        /// </summary>
        /// <returns>True when a valid country calling code can be found.</returns>
        private bool AttemptToExtractCountryCallingCode()
        {
            if (nationalNumber.Length == 0)
            {
                return(false);
            }
            var numberWithoutCountryCallingCode = new StringBuilder();
            var countryCode = phoneUtil.ExtractCountryCode(nationalNumber, numberWithoutCountryCallingCode);

            if (countryCode == 0)
            {
                return(false);
            }
            nationalNumber.Length = 0;
            nationalNumber.Append(numberWithoutCountryCallingCode);
            var newRegionCode = phoneUtil.GetRegionCodeForCountryCode(countryCode);

            if (PhoneNumberUtil.REGION_CODE_FOR_NON_GEO_ENTITY.Equals(newRegionCode))
            {
                currentMetadata = phoneUtil.GetMetadataForNonGeographicalRegion(countryCode);
            }
            else if (!newRegionCode.Equals(defaultCountry))
            {
                currentMetadata = GetMetadataForRegion(newRegionCode);
            }
            var countryCodeString = countryCode.ToString();

            prefixBeforeNationalNumber.Append(countryCodeString).Append(SeparatorBeforeNationalNumber);
            // When we have successfully extracted the IDD, the previously extracted NDD should be cleared
            // because it is no longer valid.
            extractedNationalPrefix = "";
            return(true);
        }
        /**
         * Extracts the country calling code from the beginning of nationalNumber to
         * prefixBeforeNationalNumber when they are available, and places the remaining input into
         * nationalNumber.
         *
         * @return  true when a valid country calling code can be found.
         */
        private bool AttemptToExtractCountryCallingCode()
        {
            if (nationalNumber.Length == 0)
            {
                return(false);
            }
            StringBuilder numberWithoutCountryCallingCode = new StringBuilder();
            int           countryCode = phoneUtil.ExtractCountryCode(nationalNumber, numberWithoutCountryCallingCode);

            if (countryCode == 0)
            {
                return(false);
            }
            nationalNumber.Length = 0;
            nationalNumber.Append(numberWithoutCountryCallingCode);
            String newRegionCode = phoneUtil.GetRegionCodeForCountryCode(countryCode);

            if (PhoneNumberUtil.REGION_CODE_FOR_NON_GEO_ENTITY.Equals(newRegionCode))
            {
                currentMetaData = phoneUtil.GetMetadataForNonGeographicalRegion(countryCode);
            }
            else if (!newRegionCode.Equals(defaultCountry))
            {
                currentMetaData = GetMetadataForRegion(newRegionCode);
            }
            String countryCodeString = countryCode.ToString();

            prefixBeforeNationalNumber.Append(countryCodeString).Append(" ");
            return(true);
        }