Filtering strings in multiline textbox
Posted on 2008-10-02
I have a form in asp.net c# that contains a multiline textbox. The purpose of the textbox is to allow users to type or paste a list of 10-digit phone numbers (potentially up to 100). The numbers will be in various formats when typed/pasted (i.e. "(555)555-5555", "555-555-5555", "5555555555", etc.). I need a way to "clean" the numbers so that any non-numeric characters are removed and each 10-digit number is separated by a semi-colon (instead of a space, comma, cr, etc.).
5555555555 555-555-5555, (555)555-5555
would be cleaned to:
Your assistance is greatly appreciated. Please let me know if additional detail is required.