-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4c8fd8
commit 3217ffc
Showing
4 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/PhoneNumbers/Formatters/FormatProviders/MXPhoneNumberFormatProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace PhoneNumbers.Formatters.FormatProviders; | ||
|
||
/// <summary> | ||
/// A <see cref="PhoneNumberFormatProvider"/> for Mexico numbers. | ||
/// </summary> | ||
internal sealed class MXPhoneNumberFormatProvider : ComplexPhoneNumberFormatProvider | ||
{ | ||
private MXPhoneNumberFormatProvider() | ||
{ | ||
} | ||
|
||
internal static PhoneNumberFormatProvider Instance { get; } = new MXPhoneNumberFormatProvider(); | ||
|
||
protected override string ProvideFormat(PhoneNumber phoneNumber, bool international) => | ||
phoneNumber.NationalSignificantNumber!.Length switch | ||
{ | ||
10 => "## #### ####", | ||
_ => base.ProvideFormat(phoneNumber, international), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters