stripping non numeric

Results 1 to 2 of 2

Thread: stripping non numeric

  1. #1
    Join Date
    Dec 1969

    Default stripping non numeric

    How do you take a phone number from an access database to put in SQL7 and strip all the characters that are not numeric

  2. #2
    Join Date
    Dec 1969

    Default RE: stripping non numeric

    Use regular expression! VBScript allows you to use regular expression. See:<BR><BR>An Introduction to Regular Expression w/VBScript<BR><BR><BR>So, here&#039s how you could do it. Use the Replace method of the RegExp object to replace all characters NOT in 0-9 with whitespace (or with whatever you are interested in replacing non-numeric characters with).<BR><BR>Dim strWithNonNumeric, strNumericOnly<BR>strWithNonNumeric = "555-555-1234"<BR><BR>&#039This following code will strip the hyphens<BR>Dim objRegExp<BR>Set objRegExp = New regexp<BR><BR>objRegExp.Global = True<BR>objRegExp.Pattern = "[^0-9]"<BR><BR>strNumericOnly = objRegExp.Replace(strWithNonNumeric, "")<BR><BR><BR>There ya go! Happy Programming

Posting Permissions

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