 |
| |
| Overview |
| |
| For a broader overview of comparisons in scripting,consult one of the following sections of this user manual: |
• Comparators
• Flow Control Commands |
| The commands described below deal with special cases involving comparison. |
| |
| AlphaNumPatt |
| |
| Parse-O-Matic Scripting supports several types of comparators: |
| |
| Format |
v1 =AlphaNumPatt v2 [v3 ] |
| Example |
X =AlphaNumPatt '416-287-8892';Set X to 'NNN-NNN-NNNN' |
| Purpose |
Creates a pattern of characters representing the format
of variable v2 in terms of alphabetic,numeric and special
characters |
| Parameters |
v1 -Variable being set
v2 -Value being analyzed
v3 -Control setting |
| Controls |
v3 is a TrimChar specification |
| Defaults |
v3 =''(no trimming) |
| Similar Cmds |
Numeric
See also the Matches or Comprises comparators |
|
| |
| AlphaNumPatt returns an 'A'for every letter (uppercase or lowercase)in v2,and an 'N'for every digit.All other characters (spaces,dashes etc.)are left as-is.Here are some sample results: |
| |
| ——————————— |
——————————— |
——————————— |
——————————— |
——————————— |
——————————— |
| Value of v2 |
Value of v3 |
Result (v1) |
Value of v2 |
Value of v3 |
Result (v1) |
| ——————————— |
——————————— |
——————————— |
——————————— |
——————————— |
——————————— |
| '12-34-56' |
(Not set) |
'NN-NN-NN' |
'$12.34 ' |
(Not set) |
'$NN.NN ' |
| 'AB 1234' |
(Not set) |
'AA NNNN' |
'XY 999 ' |
'B ' |
'AA NNN' |
| ———————————— |
——————————— |
———————————— |
——————————— |
——————————— |
——————————— |
|
| |
| AlphaNumPatt is handy for detecting the presence or conformity of a phone number,serial number,part number etc.,and is sometimes more convenient than the Matches and Comprises comparators. |
| |
| CompareCtrl |
| |
| Here is a list of the literal comparators: |
| |
| Format |
CompareCtrl v1 |
| Example |
CompareCtrl 'MatchCase' |
| Purpose |
Changes the default case sensitivity of comparisons |
| Parameters |
v1 =Control setting |
| Controls |
IgnoreCase/MatchCase |
| Similar Cmds |
Que |
|
Unless otherwise instructed by CompareCtrl,comparisons ignore text case,so that (for example)'Cat'is considered the same as 'CAT'or 'cat'.You can use CompareCtrl to change this behaviour.
CompareCtrl affects comparisons only ;it does not affect commands that search for text,such as Change, FindPosn, Lookup, Parse, Insert and so on. |
| |
| Numeric |
| |
| With some restrictions (discussed later),literal comparators work on both numeric and alphabetic data.Here are some examples of literal comparisons that are true: |
| Format |
v1 =Numeric v2 [v3 ] |
| Example |
X =Numeric '3.14159''Yes';Set X to 'Y' |
| Purpose |
Evaluates whether or not a value is numeric |
| Parameters |
v1 -Variable being set to 'Y'or 'N'(for Yes and No)
v2 -Value being assessed
v3 -Control setting:allow decimal point? |
| Controls |
No/Yes |
| Defaults |
v3 ='No'(do not allow a decimal point —accept only integers) |
| Similar Cmds |
The Matches and Comprises comparators |
|
| |
This function returns 'Y'if v2 is numeric (i.e.a number).Otherwise,it returns 'N'.
A leading -or +character is considered an acceptable part of a numeric value.Multiple decimal points (e.g. '12.34.56')are not accepted as numeric.Scientific notation (e.g.'1E32')is not accepted as numeric. |
| |
| Que |
| |
| Format |
v1 =Que v2 k3 v4 [v5 ] |
| Example |
MyVar =Que 'Cat'='Dog';Compare two strings |
| Purpose |
Saves the result of a comparison |
| Parameters |
v1 -Variable being set to 'Y'or 'N'(for True or False)
v2 -Value to be compared
k3 -Comparator
v4 -Value to compare to v2
v5 -Control setting |
| Controls |
IgnoreCase/MatchCase |
| Defaults |
v5 ='IgnoreCase'(unless overridden by CompareCtrl) |
| Similar Cmds |
If,Begin |
|
| Que (short for “Question")is useful when you need to save the result of a comparison,or if you need a single instance of case sensitivity.For most comparisons,however,you will use If or Begin. (This page is part of the
online user manual for Parse-O-Matic. Parse-O-Matic is a
programmable parsing tool that can extract, manipulate, convert or mine
existing data sources and turn them into importable data. For more
information on Parse-O-Matic products and conversion services, please
visit www.ParseOMatic.com) |
| |