help with tacky code?

Results 1 to 2 of 2

Thread: help with tacky code?

  1. #1
    Join Date
    Dec 1969

    Default help with tacky code?

    In an attempt to strip the characters "(", ")", "-", and " " from a phone number input field, I have this rather tacky looking piece of code:<BR>strPhone = Replace(Request.Form("txtPhoneNum"),"(","")<BR>str Phone = Replace(strPhone,")","")<BR>strPhone = Replace(strPhone,"-","")<BR>strPhone = Trim(Replace(strPhone," ",""))<BR>Is there a way to do this using a single replace statement or perhaps a regular expression?<BR>Thank if you can help.

  2. #2
    Steve Cimino Guest

    Default RE: help with tacky code?

    That&#039;s what I use...<BR><BR>why worry about the overhead of creating the RegExp object? I&#039;ll bet your way if faster.<BR><BR>BUT, there is no way to do it in one replace statement. If you want to take the regexp route, do a time comparison.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts