Fastest way to format a phone number in C#?

后端 未结 5 1625
生来不讨喜
生来不讨喜 2020-12-10 01:25

What is the fastest way to format a string using the US phone format [(XXX) XXX-XXXX] using c#?

My source format is a string.

5条回答
  •  情书的邮戳
    2020-12-10 01:37

    String.Format("{0:(###) ###-#### x ###}", double.Parse("1234567890123"))
    

    Will result in (123) 456-7890 x 123

提交回复
热议问题