public final String formatCommonNational ( final PhoneNumberInterface pphoneNumberData ) { final StringBuilder resultNumber = new StringBuilder ( ) ; if ( isPhoneNumberNotEmpty ( pphoneNumberData ) ) { PhoneCountryData phoneCountryData = null ; for ( final PhoneCountryCodeData country : CreatePhoneCountryConstantsClass . create ( ) . countryCodeData ( ) ) { if ( StringUtils . equals ( country . getCountryCode ( ) , pphoneNumberData . getCountryCode ( ) ) ) { phoneCountryData = country . getPhoneCountryData ( ) ; break ; } } if ( phoneCountryData == null ) { return null ; } resultNumber . append ( phoneCountryData . getTrunkCode ( ) ) . append ( ' ' ) ; resultNumber . append ( this . groupIntoParts ( pphoneNumberData . getAreaCode ( ) , 2 ) ) ; resultNumber . append ( " / " ) ; resultNumber . append ( this . groupIntoParts ( pphoneNumberData . getLineNumber ( ) , 2 ) ) ; if ( StringUtils . isNotBlank ( pphoneNumberData . getExtension ( ) ) ) { resultNumber . append ( " - " ) ; resultNumber . append ( this . groupIntoParts ( pphoneNumberData . getExtension ( ) , 2 ) ) ; } } return StringUtils . trimToNull ( resultNumber . toString ( ) ) ; }
format phone number in Common national format .