title: Convert an international phone number into a national number
body: <p>I'm using the <a href="https://github.com/google/libphonenumber" rel="nofollow noreferrer"><code>libphonenumber</code></a> google library to convert an international phone number into a national number.</p>
  <pre><code>var phoneNumberUtil = PhoneNumberUtil.getInstance();
  var phoneNumber = phoneNumberUtil.parse(internationalPhoneNumber, null);
  var formattedPhoneNumber = phoneNumberUtil.format(phoneNumber, PhoneNumberUtil.PhoneNumberFormat.NATIONAL).replaceAll(&quot;\\s&quot;, &quot;&quot;);
  </code></pre>
  <p>An example of an <code>internationalPhoneNumber</code> is &quot;+919744012345&quot;</p>
  <p>The <code>formattedPhoneNumber</code> I am expecting is &quot;9744012345&quot; (<a href="https://en.wikipedia.org/wiki/Mobile_telephone_numbering_in_India" rel="nofollow noreferrer">See the Mobile telephone numbering in India</a>), but instead, I am getting &quot;<strong>0</strong>9744012345&quot; with a leading zero.</p>
  <p>How to convert the international phone number correctly?</p>