LF Fortran 95

LGE Function

Description

The LGE function tests whether a string is lexically greater than or equal to another string based on the ordering of the ASCII collating sequence.

Syntax

LGE (string_a, string_b)

Arguments

string_a is an INTENT(IN) scalar or array of type CHARACTER.

string_b is an INTENT(IN) scalar or array of type CHARACTER.

If string_a and string_b are both arrays, they must have the same shape.

Result

The result is of type default LOGICAL. Its value is true if string_b precedes string_a in the ASCII collating sequence, or if the strings are the same; otherwise the result is false.

Trailing blanks are ignored.

If both strings are of zero length the result is true.

Example

character(len=3) :: a="abc",b="ABC" character(len=0) :: a1,b1 character(len=5) :: c1(2)=(/"abc ","123 "/) character(len=5) :: c2(2)=(/"CBA "," 123"/) write(*,*) lge(a,b) ! writes T write(*,*) lge(a,c1) ! writes T T write(*,*) lge(c2,a) ! writes F F write(*,*) lge(c1,c2) ! writes T T

Also

ASCII Character Set