Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Phone Characters to Numbers

Status
Not open for further replies.

Esoteric

ISP
Feb 10, 2001
93
US
Is there a quick way to take this
(555) 555-1212 and convert it to this 5555551212?

Please help - I thought maybe a trim or Replace function might do this, without a function.
 
Dim regEx
Set regEx = New RegExp
regEx.Global = true
regEx.Pattern = "[\(\)\-\s]"
str = "(333) 333-3333"
str = Trim(regEx.Replace(str, ""))
alert str
admin@onpntwebdesigns.com
 
This also works:
str = "(555) 555-1212"
str = replace(replace(replace(replace(str,"-", "")," ", ""),")", ""),"(", "")
 
(makes debugging hell!)
I agree, but he seemed to want to use either the trim or replace function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top