title: formatting phone numbers using libPhoneNumber
body: <p>I am using libPhone library in angular js application to validate if the phone numbers are valid. However I have to show the valid format that the user has to provide in case the phone number entered is invalid.</p>
  
  <p>The user will provide the country code and the phone number. For example if the user needs to provide a U.S number, then the format to be shown to the user is : xxx-xxx-xxxx</p>
  
  <p>I was trying to do that by using a work around, illustrating that for a Mexican number by calling <code>getPhoneFormat('mx')</code></p>
  
  <pre><code>  var getPhoneFormat = function(countryCode) {
           var exampleNum = phoneUtil.getExampleNumberForType(countryCode, libphonenumber.PhoneNumberType.MOBILE);
           var formattedNum =  phoneUtil.format(exampleNum, libphonenumber.PhoneNumberFormat.RFC3966);
           //formattedNum -&gt; tel:+52-1-222-123-4567
  
           //then i was thinking of removing the prefix by checking the position of the 1st '-'
            var removeFromIndex =  formattedNum.indexOf('-') + 1
            var validFormat =  formattedNum.substring(removeFromIndex);
            //valid format is -&gt;   1-222-123-4567
  
            //finally replace numbers with x and return
       }
  </code></pre>
  
  <p>Is there some methods that the library provides to satisfy the same requirements? I saw <code>formatByPattern</code> but not sure how to use it.</p>