Removing characters from tel. number


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Removing characters from tel. number

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Posts
    2

    Question Removing characters from tel. number

    Can anyone tell me how to remove all non-number characters from a string such as a tel. number before it is inserted into a database?
    Thank you.

  2. #2
    Join Date
    Dec 2003
    Location
    tx/us
    Posts
    131
    Use a StringBuffer. Loop through the tel num String and append each numerical character (test with Character.isDigit(ch)) to the StringBuffer. Use the content of the StringBuffer as the value for the database field.

  3. #3
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468

    Also look at StringBuilder

    The same will work with StringBuilder, which provides the same functionality at a faster speed (unless you need to work with threads and this method has to be synchronized).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center