QTP Code to strip out a phone number?

Nalder, Jay JNalder at ascprofiles.com
Wed Feb 13 14:02:07 CST 2008


Will this get you started?

define phone-digits char*10 = no-phone       if matchpattern(no-phone, "##########") else &
                              no-phone[02:3] + &
                              no-phone[06:3] + &
                              no-phone[10:4] if matchpattern(no-phone, "(###)###-####") else &
                              no-phone[01:3] + &
                              no-phone[05:3] + &
                              no-phone[09:4] if matchpattern(no-phone, "###-###-####") else &
                              no-phone[01:3] + &
                              no-phone[05:3] + &
                              no-phone[09:4] if matchpattern(no-phone, "###.###.####")

define phone-num int*8 = nconvert(phone-digits)


in this example [no-phone] is a character field of suitable length.
If you have other formats that you want to catch, then you could add more cases to the define.
It may not be the most efficient, but on the other hand, I believe that it is easy to read,

Jay Nalder.

From: powerh-l-bounces+jnalder=ascprofiles.com at lists.sowder.com [mailto:powerh-l-bounces+jnalder=ascprofiles.com at lists.sowder.com] On Behalf Of Johnson, Tracy
Sent: Wednesday, February 13, 2008 11:43 AM
To: Ken Langendock; powerh-l at lists.sowder.com
Subject: RE: QTP Code to strip out a phone number?

Isn't there an example of this using Soundex in the old 5.01 manuals?

________________________________
From: powerh-l-bounces+tracy.johnson=meas-spec.com at lists.sowder.com [mailto:powerh-l-bounces+tracy.johnson=meas-spec.com at lists.sowder.com] On Behalf Of Ken Langendock
Sent: Wednesday, February 13, 2008 2:02 PM
To: powerh-l at lists.sowder.com
Subject: QTP Code to strip out a phone number?
Hello all, Anyone created a routine to strip out a phone number from a string already?

(555) 432-0434 to 5554320434
or
555-432-0434
or
555.432.0434

or any other layout that might be input?

Ken

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sowder.com/pipermail/powerh-l/attachments/20080213/4099ec32/attachment.html


More information about the powerh-l mailing list