|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Testing Commands > ITS. / NTS. - If Test Condition > ITS. / NTS. - If Test Condition |
MiniRobotLanguage (MRL)
ITS. Is PhoneNumber
NTS. Is PhoneNumber
If if a given string meets the criteria for a valid phone number
Intention
Conditional Statement.
To validate the format of a phone number string, ensuring it meets predefined criteria for mobile or landline (housephone) numbers.
Character Set: Ensures the phone number consists only of allowed characters (digits, plus signs, spaces, parentheses, hyphens).
Length Check: Confirms the phone number is within a reasonable digit count after stripping non-digit characters, typically between 7 to 15 digits.
Special Character Usage: Validates the proper placement of special characters, such as a single plus sign at the beginning and correct usage of parentheses and hyphens.
The validation process is designed to ensure the structural integrity of phone numbers, accommodating different formats including international, landline, and mobile numbers.
This versatile approach allows for a broad range of phone number formats to be validated, reflecting real-world diversity in numbering plans.
While the command validates the format of phone numbers, it does not verify their existence or operational status.
The assumptions made about phone number structures may not account for all national or regional variations in numbering plans.
Extended Example Use Case:
This example demonstrates the validation of different types of phone numbers: generic, landline, and mobile.
' Generate a generic phone number
TST.Generate PhoneNumber|$$N01|0
ITS.Is PhoneNumber|$$N01
DBP.$$N01 is a valid PhoneNumber.
ELS.
DBP.$$N01 is NOT a valid PhoneNumber.
EIF.
' Generate a landline phone number
TST.Generate PhoneNumber|$$N02|1
ITS.Is PhoneNumber|$$N02
DBP.$$N02 is a valid landline PhoneNumber.
ELS.
DBP.$$N02 is NOT a valid landline PhoneNumber.
EIF.
' Generate a mobile phone number
TST.Generate PhoneNumber|$$N03|2
ITS.Is PhoneNumber|$$N03
DBP.$$N03 is a valid mobile PhoneNumber.
ELS.
DBP.$$N03 is NOT a valid mobile PhoneNumber.
EIF.
ENR.
Explanation of TST.Generate PhoneNumber Command
TST.Generate PhoneNumber|$$N01|0 generates either a mobile or a house phone number and stores it in $$N01.
TST.Generate PhoneNumber|$$N02|1 generates a landline (housephone) number and stores it in $$N02.
TST.Generate PhoneNumber|$$N03|2 generates a mobile phone number and stores it in $$N03.
Syntax
ITS.Is PhoneNumber|P1 … ELS. … EIF.
NTS.Is PhoneNumber|P1 … ELS. … EIF.
Parameter Explanation
P1 - The variable containing the phone number string to be validated.
Example
'***********************************
' ITS.-Sample
'***********************************
' Generate a generic phone number
TST.Generate PhoneNumber|$$N01|0
ITS.Is PhoneNumber|$$N01
DBP.$$N01 is a valid PhoneNumber.
ELS.
DBP.$$N01 is NOT a valid PhoneNumber.
EIF.
' Generate a landline phone number
TST.Generate PhoneNumber|$$N02|1
ITS.Is PhoneNumber|$$N02
DBP.$$N02 is a valid landline PhoneNumber.
ELS.
DBP.$$N02 is NOT a valid landline PhoneNumber.
EIF.
' Generate a mobile phone number
TST.Generate PhoneNumber|$$N03|2
ITS.Is PhoneNumber|$$N03
DBP.$$N03 is a valid mobile PhoneNumber.
ELS.
DBP.$$N03 is NOT a valid mobile PhoneNumber.
EIF.
ENR.
Remarks
-
Limitations:
-
See also:
•