ITS. / NTS. - If Test Condition

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Testing Commands > ITS. / NTS. - If Test Condition >

ITS. / NTS. - If Test Condition

ITS. / NTS. Is Name Part

Previous Top Next


MiniRobotLanguage (MRL)

 

ITS.Is Name Part

NTS.Is Name Part

Test if a string is as a legitimate part of a name

 

 

Intention

 

Conditional Statement.

To validate a given string as a legitimate part of a name, which could be a first name, last name, or any part of a full name depending on the parameters specified.

To ensure that a given string segment adheres to the naming conventions appropriate for either a first name, a middle name, or a last name.

This command includes validations for character content, starting and ending character types, and character sequence rules.

 

Trimming and Length Check: Validates that the name part is not empty after trimming and is within the length constraints (e.g., between 2 and 50 characters).

Valid Character Set: The command checks for a specific set of valid characters, which includes letters, hyphens, apostrophes, and diacritics.

Proper Use of Special Characters: Ensures special characters like hyphens and apostrophes are not at the beginning, end, or in sequence.

Case Sensitivity: Verifies that the name part starts with an uppercase letter and does not end with a non-letter character.

Specific Checks for Name Types: Implements additional validation rules for different types of name parts, like ensuring last names do not start or end with invalid characters.

Specificity to Name Parts: This command allows for differentiation between first names, last names, and any part of a name, which can be important in contexts where different rules apply to different parts of a name.

Optional Parameter for Versatility: The inclusion of the P2 parameter allows for one command to handle multiple types of name part validations.

Comprehensive Name Validation: Checks for each part of the name—first, middle, and last—to ensure all comply with validation criteria.

Special Character Rules: Ensures characters like hyphens and apostrophes are appropriately placed within name parts.

Cultural Variability: Recognizes different cultural norms by allowing diacritical marks and providing the option to validate any part of a name.

 

The ITS. command offers nuanced validation of name parts and can be adjusted for first names, last names, or any name parts.

The NTS. command verifies the inverse, ensuring the string does not meet the criteria for a valid name part.

 

 

TST.Get Lastname by Country|DEU|$$N02

TST.Generate PreName|GER|$$N01

TST.Generate PreName|GER|$$N03  ' Assume this generates a middle name

 

' Combine to form a possible full name

$$N04=$$N01 $$N03 $$N02

 

' Validate each part of the name

ITS.Is Name Part|$$N01|0

DBP.$$N01 is a valid first name.

ELS.

DBP.$$N01 is NOT a valid first name.

EIF.

 

ITS.Is Name Part|$$N03|3

DBP.$$N03 is a valid middle name.

ELS.

DBP.$$N03 is NOT a valid middle name.

EIF.

 

ITS.Is Name Part|$$N02|1

DBP.$$N02 is a valid last name.

ELS.

DBP.$$N02 is NOT a valid last name.

EIF.

 

' Validate the full combination as a possible full name

ITS.Is Name Part|$$N04|3

DBP.$$N04 is a valid full name.

ELS.

DBP.$$N04 is NOT a valid full name.

EIF.

 

ENR.

 

The result could indicate:

Johannes Maximilian Bauer is a valid full name.

 

 

 

Syntax

 

 

ITS.Is Name Part|P1|[P2] … ELS. … EIF.

NTS.Is Name Part|P1|[P2] … ELS. … EIF.

 

 

 

Parameter Explanation

 

P1 - The variable containing the name part to be validated.

P2 - (optional) A number that specifies the type of name part to validate: 0 for a first name, 1 for a last name, or 3 for any name part.

 

 

 

Example

 

'***********************************

' ITS.-Sample

'***********************************
TST.Get Lastname by Country|DEU|$$N02

TST.Generate PreName|GER|$$N01

 

' Assume $$N03 is used for a middle name

TST.Generate PreName|GER|$$N03  

 

' Combine for a full name with middle part

$$N04=$$N01 $$N03 $$N02  

 

ITS.Is Name Part|$$N01|0  ' Validate first name

 DBP.$$N01 is a valid first name part.

ELS.

 DBP.$$N01 is NOT a valid first name part.

EIF.

 

ITS.Is Name Part|$$N03|3  ' Validate middle name

 DBP.$$N03 is a valid middle name part.

ELS.

 DBP.$$N03 is NOT a valid middle name part.

EIF.

 

ITS.Is Name Part|$$N02|1  ' Validate last name

 DBP.$$N02 is a valid last name part.

ELS.

 DBP.$$N02 is NOT a valid last name part.

EIF.

 

' Output the full name validation result

DBP.$$N04 is a valid full name.

ENR.

 

 

 

Remarks

 

-

 

 

Limitations:

The command assumes certain Western naming conventions, which might not be applicable to all cultures.

Special diacritic characters are considered valid, but only certain types may be allowed, depending on the implementation details of the command.

 

 

See also: