Question: a) Validate the phone number by using string manipulation. a. If the phone number is not empty, validate that the phone number is in one
a) Validate the phone number by using string manipulation. a. If the phone number is not empty, validate that the phone number is in one of the following formats: i. ddd-ddd-dddd 10 digits with two dashes where the first dash is between the third and fourth digits and the second dash is between the sixth and seventh digits. ii. dddddddddd all 10 digits, or, iii. (ddd)ddddddd 10 digits with the first three digits being enclosed by parentheses. iv. (ddd)ddd-dddd 10 digits with the first three digits being enclosed by parentheses, and there is a dash between the sixth and seventh digits. b. Provide an alert if the phone number is not in the required formats. ALL four of the above formats must be accepted by the validation routine. b) Validate the email by using string manipulation. a. If the email is not empty, validate that the email string satisfies the following requirement: i. The email string must contains a single @ which is not in the first and last positions. ii. The email string must contain a "." which is in the 4th from last or 3rd from last positions. b. Provide an alert if the email is not in the correct format.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
