0

I passed '55' to isGlobalPhoneNumber, and it returns 'true'.

I want it only return true for US phone numbers xxx-xxx-xxxxx.

MiguelHincapieC
  • 5,445
  • 7
  • 41
  • 72
user73554
  • 93
  • 1
  • 9

1 Answers1

3

55 is a valid phone number according to the definition Android provides in its source code (as context-free grammar):

global-phone-number = ["+"] 1*( DIGIT / written-sep )
written-sep         = ("-"/".")

Whether or nor this definition is suitable for your application is, of course, independent of that definition.

dst
  • 3,307
  • 1
  • 20
  • 27