Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. string manipulation for phone numbers

string manipulation for phone numbers

Scheduled Pinned Locked Moved C#
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mikemilano
    wrote on last edited by
    #1

    I would like to be able to accept phone numbers in various formats: 800-555-1212 800.555.1212 (800) 555-1212 (800)555-1212 and then format it to this: 800-555-1212 i created a function which strips out characters: ()- so now my number is: 8005551212 but how can i put the "-" back in there to make it 800-555-1212 ? thanks in advance!

    N J 2 Replies Last reply
    0
    • M mikemilano

      I would like to be able to accept phone numbers in various formats: 800-555-1212 800.555.1212 (800) 555-1212 (800)555-1212 and then format it to this: 800-555-1212 i created a function which strips out characters: ()- so now my number is: 8005551212 but how can i put the "-" back in there to make it 800-555-1212 ? thanks in advance!

      N Offline
      N Offline
      Nathan Blomquist
      wrote on last edited by
      #2

      Check out the String.Insert() method.... --------------------------- Hmmm... what's a signature?

      1 Reply Last reply
      0
      • M mikemilano

        I would like to be able to accept phone numbers in various formats: 800-555-1212 800.555.1212 (800) 555-1212 (800)555-1212 and then format it to this: 800-555-1212 i created a function which strips out characters: ()- so now my number is: 8005551212 but how can i put the "-" back in there to make it 800-555-1212 ? thanks in advance!

        J Offline
        J Offline
        J Dunlap
        wrote on last edited by
        #3

        Use String.Format().

        "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
        "You must be the change you wish to see in the world." - Mahatma Gandhi

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups