|
<< 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 PreName Command
NTS.Is PreName Command
Test if a provided string is a valid first name (prename)
Intention
Conditional Statement.
To determine if a provided string is a valid first name (prename) as per the specified validation rules, which include length, starting character, and permissible characters.
•Trim and Length Check: Trims the first name and verifies it is within the allowable length range (e.g., between 2 and 50 characters).
•Initial Capital Letter: Ensures the first name begins with an uppercase letter.
•Valid Character Set: Allows letters, hyphens, apostrophes, and possibly diacritical marks.
•Character Positioning: Confirms that hyphens and apostrophes are not used inappropriately (e.g., at the beginning, end, or consecutively).
The ITS. command evaluates the structure and composition of a first name to ensure it meets conventional naming standards.
The NTS. command verifies that a string does not conform to the valid first name pattern.
Specificity: Unlike general string validation, this command specifically targets the unique requirements of a first name.
Cultural Sensitivity: The validation includes considerations for names with diacritical characters, which are common in many cultures and languages.
•The command may not accommodate all cultural variations of first names, especially those that do not start with an uppercase letter or include characters outside the specified valid set.
•This validation does not check for the social appropriateness or cultural correctness of the name, merely its structural adherence to the specified rules.
Example Use Case:
TST.Generate PreName|GER|$$N01
ITS.Is PreName|$$N01
DBP.$$N01 is a valid first name.
ELS.
DBP.$$N01 is NOT a valid first name.
EIF.
ENR.
The result would be something like:
Johannes is a valid first name.
Syntax
ITS.Is PreName|P1 … ELS. … EIF.
NTS.Is PreName|P1 … ELS. … EIF.
Parameter Explanation
P1 - The variable containing the string to be checked as a valid first name.
Example
'***********************************
' ITS.-Sample
'***********************************
' Generate a first name
TST.Generate PreName|GER|$$N01
' Validate the first name format
ITS.Is PreName|$$N01
' Output the validation result
DBP.$$N01 is a valid first name.
ELS.
DBP.$$N01 is NOT a valid first name.
EIF.
' End the script
ENR.
Remarks
-
Limitations:
ITS./NTS. can be nested to unlimited Depth, and they can also enclose Sub-Program Calls or FEX. (Enumerations) to unlimited Depth.
See also:
•