FNLMath : Utilities : IICSR
IICSR
This function compares two character strings using the ASCII collating sequence but without regard to case.
Function Return Value
IICSR — Comparison indicator. (Output)
Let USTR1 and USTR2 be the uppercase versions of STR1 and STR2, respectively. The following table indicates the relationship between USTR1 and USTR2 as determined by the ASCII collating sequence.
IICSR Meaning
1 USTR1 precedes USTR2
0 USTR1 equals USTR2
1 USTR1 follows USTR2
Required Arguments
STR1 — First character string. (Input)
STR2 — Second character string. (Input)
FORTRAN 90 Interface
Generic: IICSR (STR1, STR2)
Specific: The specific interface name is IICSR.
FORTRAN 77 Interface
Single: IICSR (STR1, STR2)
Description
Routine IICSR compares two character strings. It returns 1 if the first string is less than the second string, 0 if they are equal, and 1 if the first string is greater than the second string. The comparison is case insensitive.
Comments
1. If the two strings, STR1 and STR2, are of unequal length, the shorter string is considered as if it were extended with blanks to the length of the longer string.
Example
This example shows different cases on comparing two strings.
 
USE IICSR_INT
USE UMACH_INT
 
IMPLICIT NONE
INTEGER NOUT
CHARACTER STR1*6, STR2*6
! Get output unit number
CALL UMACH (2, NOUT)
! Compare String1 and String2
! String1 is 'bigger' than String2
STR1 = 'ABc 1'
STR2 = ' '
WRITE (NOUT,99999) STR1, STR2, IICSR(STR1,STR2)
!
! String1 is 'equal' to String2
STR1 = 'AbC'
STR2 = 'ABc'
WRITE (NOUT,99999) STR1, STR2, IICSR(STR1,STR2)
!
! String1 is 'smaller' than String2
STR1 = 'ABc'
STR2 = 'aBC 1'
WRITE (NOUT,99999) STR1, STR2, IICSR(STR1,STR2)
!
99999 FORMAT (' For String1 = ', A6, 'and String2 = ', A6, &
' IICSR = ', I2, /)
END
Output
 
For String1 = ABc 1 and String2 = IICSR = 1
 
For String1 = AbC and String2 = ABc IICSR = 0
 
For String1 = ABc and String2 = aBC 1 IICSR = -1
Published date: 03/19/2020
Last modified date: 03/19/2020