Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Artful Two for Clipper 5.0 - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

Syntax

IS_PHONE( cVar[, lIgnore ] )

Purpose

Validate North American phone numbers.

Arguments

     cVar -- telephone number (as a string) to check

     lIgnore -- pass anything to ignore (accept) blank area code

Setup

cVar must be a 10-digit character string (ie. no formatting characters,
like parentheses or hyphens, allowed).

Example

     LOCAL m_phone := SPACE( 10 ), ;
     phone_pic := "@R (###) 999-9999"

     @ 5, 10 GET m_phone PICTURE phone_pic ;
              VALID IS_PHONE( m_phone, .T. )
     READ_IT()

Returns

.T. if cVar represents a valid North American telephone number, else
.F.

Side Effects

None.

Artful Calls

None.

Source File

AA_ISFON.PRG

Notes

The algorithm is based on the following conventions:

The first digit of the area code cannot be a 0 or 1.

The second digit of the area code must be 0 or 1.

The first digit of the exchange code cannot be a 0 or 1.

A phone number consists of a 3-digit area code followed by a 3-digit
exchange code followed by 4 more digits.

In a GET/VALID clause, this function should be used in conjunction with the
picture specified in the example above, since the function does not in
itself check to ensure that cVar is 10 characters in length and
composed solely of digits.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson