When the country context is known, a national format can be clear. For cross-border analysis, use an international form with a leading +.
Start with context
National prefixes and dialling conventions vary. The digit string alone may not state whether a prefix is a country code.
Normalize carefully
Keep the original input, parse with the country context, and show the formatted result separately rather than rewriting user data silently.
Check the result
A parser can validate number-range syntax but not the current subscriber, network or location.
Choose the context before changing digits
A saved contact without + may be national-format text. Preserve the original instead of silently inventing a country.
Leading + is present
Next action: Interpret it as international-format input
Avoid: Prepending your own country code
National number and country are known
Next action: Parse using that country’s numbering rules
Avoid: Deleting all leading zeroes
National number and country are unknown
Next action: Ask for the intended country or retain the original
Avoid: Guessing from the user’s current location
Input begins with 00
Next action: Check the originating country’s dialling rules
Avoid: Treating 00 as a universal equivalent of +
The country context belongs to the input, not automatically to the person viewing it.