lge

Date:

10-12-2011

NAME

LGE, LGT, LLE, LLT - Compare strings lexically

SYNOPSIS

LGE ([STRING_A=]string_a, [STRING_B=]string_b)
LGT ([STRING_A=]string_a, [STRING_B=]string_b)
LLE ([STRING_A=]string_a, [STRING_B=]string_b)
LLT ([STRING_A=]string_a, [STRING_B=]string_b)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

DESCRIPTION

Each of these type logical functions takes two character-string arguments and returns a logical value. Arguments string_a and string_b are compared according to the ASCII collating sequence, and a true or false value is returned.

string_a and string_b

Must be of type default character

The defining equation for each function is as follows:

  • For LGE, logic = a1 is greater than or equal to a2

  • For LGT, logic = a1 is greater than a2

  • For LLE, logic = a1 is less than or equal to a2

  • For LLT, logic = a1 is less than a2

LGE, LGT, LLE, and LLT are elemental functions. The names of these intrinsics cannot be passed as arguments.

RETURN VALUES

If the strings are of unequal length, the comparison is made as if the shorter string were extended on the right with blanks to the length of the longer string. The return value of each intrinsic is as follows:

  • LGE. The result is true if the strings are equal or if string_a follows string_b in the ASCII collating sequence; otherwise, the result is false. Note that the result is true if both string_a and string_b are of equal length; this includes zero-length strings.

  • LGT. The result is true if string_a follows string_b in the ASCII collating sequence; otherwise, it is false. The result is false if both string_a and string_b are of zero length.

  • LLE. The result is true if the strings are equal or if string_a precedes string_b in the ASCII collating sequence; otherwise, it is false. Note that the result is true if both string_a and string_b are of equal length; this includes zero-length strings.

  • LLT. The result is true if string_a precedes string_b in the ASCII collating sequence; otherwise, it is false. The result is false if both string_a and string_b are of zero length.

NOTES

The return value is of type default logical.