The STRCMP function performs string comparisons between its two String arguments, returning True (1) for those that match and False (0) for those that do not. Normally, the IDL equality operator (EQ) is used for such comparisons, but STRCMP can optionally perform case-insensitive comparisons and can be limited to compare only the first N characters of the two strings, both of which require extra steps using the EQ operator.
Compare two strings in a case-insensitive manner, considering only the first 3 characters:
Result = STRCMP( String1, String2 [, N] [, /FOLD_CASE] )
If all of the arguments are scalar, the result is scalar. If one of the arguments is an array, the result is an integer with the same structure. If more than one argument is an array, the result has the structure of the smallest array. Each element of the result contains True (1) if the corresponding elements of String1 and String2 are the same, and False (0) otherwise.
The strings to be compared.
Normally String1 and String2 are compared in their entirety. If N is specified, the comparison is made on at most the first N characters of each string.
String comparison is normally a case sensitive operation. Set FOLD_CASE to perform case insensitive comparisons instead.
This page has no comments yet. Be the first one!