-2

I have used the same library for iOS and Android with same method/code for formatting phone number

For example the format of same Indian mobile number without country code for iOS is different from android SDK

Android SDK:    XX XX XXXXXX
iOS SDK:        XXXXX XXXXX

While formatting of US phone number using same library in iOS and Android gives similar output but for Indian mobile number the output varies.

Bhavik Modi
  • 1,517
  • 14
  • 29
  • 1
    Simply because different developers made different decisions as how to format the number. – zaph Apr 21 '15 at 13:50

1 Answers1

3

It is not the same library, it is written in different languages for the two systems. Additionally if you are using the Objective-C port yet another developer was involved. The library binaries and most likely source as well are different. What is the same is the public interface and name. Get the code for the two and compare how the formatting is done. There is also a good chance the two implementations use OS APIs for part and there are differences there as well.

From National conventions for writing telephone numbers

Telephone numbers in India are 10 digits long (excluding an initial zero which is required at times) and fall in at least four distinct categories:

Landlines: Written as 0AAA-BBBBBBB, where AAA is the Subscriber Trunk Dialing code (long distance code) and BBBBBBB is the phone number. The total length of the Subscriber Trunk Dialing code and the phone number is 10 digits.

Mobiles: Written as AAAAA-BBBBB for ease of remembering (though the prefix is either 2-digits or 4-digits in the numbering plan). Mobile numbers which are not local need to be prefixed by a 0 while dialing, or by +91 (91 is the country code for India). A mobile number written as +91-AAAAA-BBBBB is valid throughout India, and in other countries where the + is recognized as a prefix to the country code.

zaph
  • 111,848
  • 21
  • 189
  • 228
  • 1
    Nice explanation regarding XXXXX XXXXX format, what about this, Why different in Android XX XX XXXXXX. If XXXXX XXXXX is valid throughout, Why another format with Android. – voidRy Apr 22 '15 at 06:00
  • As in my comment, simply that is what the programmer decided. – zaph Apr 22 '15 at 06:03
  • @Zaph any library shouldn't provide different output for the same inputs. – Bhavik Modi Apr 22 '15 at 06:18
  • 1
    Enhanced the answer to include library issues to match the updated question. – zaph Apr 22 '15 at 13:30