The SUBSTRNG routine detects the presence of one string of characters (field 1) within another string of characters (field 2), excluding blank strings. This routine requires two fields defined from each record: field 1 is the first field, field 2 is the second field. It performs two comparisons:
- Compares field 1 from record 1 with field 2 from record 2 and detects whether field 1 is a substring of field 2.
- Compares field 1 from record 2 with field 2 from record 1 and detects whether field 1 is a substring of field 2.
This routine returns the highest of the two comparison scores.
Note: The SUBSTRNG routine performs the comparison in one direction only; the routine looks
for field 1 in field 2 and not vice versa. It does not look for field 2 in field 1.
Score |
Description |
---|---|
100 |
First string is exactly the second string. |
99 |
First string resides at the beginning of the second string. |
98 |
First string resides at the end of the second string. |
97 |
First string resides within the second string. |
0 |
Any other value. |
Example
Record | Field 1 | Field 2 |
1 |
J |
John Paul |
2 |
Paul |
John |
Field 1/Rec 1 |
vs | Field 2/Rec 2 | Score | |
Comparison 1 |
J |
John | 99 | |
Field 1/Rec 2 | vs | Field 2/Rec 1 | ||
Comparison 2 |
Paul |
John Paul | 98 | |
Score returned | 99 |