0

I get a list of contact numbers from the address book of the mobile (both iOS and Android). But they are all not uniform.Sometime I get phone number with countrycode like (+919912345678) or I get numbers with preceding zero like 09912345678 or I get numbers with no country code and preceding zeros like 9912345678

Can anyone please suggest how to knock of the country code and the preceding zero's and get only the national number say in this case 9912345678.

I am currently doing string replace '+' with blank and replace the numbers starting with 0 to nothing.

I believe there should be a better way to do this.

I am looking at all country codes and not +91 alone.

The input to the function should be a contact number in any format and I am looking for the national number of the format.

(The scope is only mobile number)

Thanks for your time and effort in helping me.

Timothy Rajan
  • 1,947
  • 8
  • 38
  • 62

1 Answers1

0

Well, if I understand your question correct. You need to extract the country information elswhere and use that as input to get the international access number.

PageMaker
  • 395
  • 1
  • 3
  • 10
  • Thanks for your response. What I need is if I get a mobile number, I need to knock off the country code if it exists in the mobile number and also the '0' which precedes the number in the absence of a country code. – Timothy Rajan Nov 16 '13 at 20:39