PhoneNumberFormatter Class

Definition

Formats phone numbers.

public ref class PhoneNumberFormatter sealed
/// [Windows.Foundation.Metadata.Activatable(196608, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 196608)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class PhoneNumberFormatter final
[Windows.Foundation.Metadata.Activatable(196608, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 196608)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class PhoneNumberFormatter
function PhoneNumberFormatter()
Public NotInheritable Class PhoneNumberFormatter
Inheritance
Object Platform::Object IInspectable PhoneNumberFormatter
Attributes

Windows requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

Constructors

PhoneNumberFormatter()

Creates a PhoneNumberFormatter object, using the current default region.

Methods

Format(PhoneNumberInfo)

Returns a string representation of the provided phone number.

Format(PhoneNumberInfo, PhoneNumberFormat)

Returns a string representing the given phone number, using the given format.

FormatPartialString(String)

Returns a string representing the formatted partial phone number given.

Use this method to format phone numbers as they are being entered by a user, to help the user visualize the complete, formatted number.

FormatString(String)

Returns the input string, formatted as a phone number.

FormatStringWithLeftToRightMarkers(String)

Returns the input string, formatted as a phone number, surrounded by Unicode Left to Right (LTR) markers.

GetCountryCodeForRegion(String)

Static method that returns the country code for a given region code.

GetNationalDirectDialingPrefixForRegion(String, Boolean)

Static method that returns the national direct dialing prefix for the given region.

TryCreate(String, PhoneNumberFormatter)

Attempts to create a PhoneNumberFormatter for a given region code, and doesn't throw on failure.

WrapWithLeftToRightMarkers(String)

Wraps a string with Unicode Left to Right (LTR) markers.

Applies to