ASP 101 - Active Server Pages 101 - Web03
The Place ASP Developers Go!



Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash





ASP.NET version of "Phone Number Format"


This sample takes a phone number in any old format and attempts to wrangle it into a nice uniform format. It's great to use for form validation, before placing the number into a database, or to create good looking reports.

I used the "(800) 555-1212" format, but changing it to whatever format you prefer is simple. Just for fun I also threw in some basic error handling for when the number doesn't have 10 digits (or 11 if the first is a 1). The error handling is quite trivial, but it is in there if you want to build on it.

Here's a zip file of the code (1.9 KB).

Play with the running version.

View the live source code.


Back to the "Phone Number Format" sample


Samples

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers