TACL Reference Manual
UTILS:TACL Commands and Functions
HP NonStop TACL Reference Manual—429513-018
8-37
_COMPAREV Function
_COMPAREV Function
Use the _COMPAREV function to compare one string with another. The _COMPAREV
function is an alias for the #COMPAREV built-in function.
string-1 and string-2
are the names of existing variable levels or STRUCT items, text enclosed in
quotation marks, or a concatenation of such elements. The concatenation operator
is '+' (the apostrophes are required). Variables must not be of type DIRECTORY.
Result
_COMPAREV returns a nonzero value if the contents of the strings are the same, zero
if they are different.
Considerations
•
You can compare any combination of STRUCTs and STRUCT items with each
other. Such comparisons are case-sensitive.
•
You can compare any combination of variables that are not of type DIRECTORY or
STRUCT and are not STRUCT items. Such comparisons are not case-sensitive.
•
You should use _COMPAREV when a variable level contains text with spaces or
when you do not want to obtain the contents of a variable level.
•
The comparison is not case-sensitive; that is, an uppercase character is equivalent
to its lowercase counterpart.
•
To compare a text string to a template, use the #MATCH built-in function.
Examples
1. This example illustrates _COMPAREV, using #OUTPUT to display the result:
5> PUSH A B
6> #SET A Hello
7> #SET B Goodbye
8> #OUTPUT [_COMPAREV A B]
0
2. The next example illustrates the use of _COMPAREV within a routine:
#PUSH A B
#SET A Hello
#SET B Goodbye
[#IF [_COMPAREV A B] |THEN|
#OUTPUT A equals B
|ELSE|
#OUTPUT A does not equal B
]
_COMPAREV string-1 string-2