Skip to content

PhoneNumberFormatter

Formats a phone number (with an optional extension) into SAIF's preferred display style (###.###.#### with an optional x<extension> suffix), delegating the digit validation and splitting work to an internally constructed PhoneNumberParser.

Purpose

  • Produces the SAIF-preferred, dot-separated display format for a phone number, appending an extension when supplied.
  • Falls back to the original, unformatted input when the number cannot be parsed as a standard 10-digit US number.

Context

  • Namespace: SAIF.Services.Utilities
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet package)

Public members

Member Signature Purpose
PhoneNumberFormatter(phoneNumber) public PhoneNumberFormatter(string phoneNumber) Stores the raw phone number to format, with no extension.
PhoneNumberFormatter(phoneNumber, extension) public PhoneNumberFormatter(string phoneNumber, string extension) Stores the raw phone number and an extension to append when formatting.
SaifPreferredDisplayPhoneNumber public string SaifPreferredDisplayPhoneNumber { get; } The phone number formatted as AAA.PPP.NNNN, with x<extension> appended when an extension was supplied and the number parses successfully; otherwise the original input string unchanged.

Behavioral notes

  • Formatting logic is entirely re-evaluated on each access of SaifPreferredDisplayPhoneNumber (it is a computed property, not a cached value)*.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • Services/SAIF.Services/Utilities/PhoneNumberFormatter.cs