Format a Phone Number


/ Published in: VB.NET
Save to your folder(s)

It's important that the newPn var that you pass into the Convert.ToInt64 function is in the xxxxxxxxxx format and that no characters are present.


Copy this code and paste it in your HTML
  1. Dim pn As String = "(444) 444-444"
  2. Dim newPn As String = Replace(Replace(Replace(pn, "-", ""), "(", ""), ")", "")
  3. newPn = String.Format("{0:###-###-####}", Convert.ToInt64(newPn))

URL: http://codefinds.blogspot.com/2008/12/format-phone-number.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.