Manual Reference Pages  - lgt (3fortran)

NAME

LGT(3) - [CHARACTER:COMPARE] ASCII Lexical greater than

SYNOPSIS

result = lgt(string_a, string_b)

          elemental logical function lgt(string_a, string_b)

character(len=*),intent(in) :: string_a character(len=*),intent(in) :: string_b

CHARACTERISTICS

o STRING_A is default character or an ASCII character.
o STRING_B is the same type and kind as STRING_A
o the result is a default logical

DESCRIPTION

LGT(3) determines whether one string is lexically greater than another string, where the two strings are interpreted as containing ASCII character codes. If the String A and String B are not the same length, the shorter is compared as if spaces were appended to it to form a value that has the same length as the longer.

In general, the lexical comparison intrinsics LGE, LGT, LLE, and LLT differ from the corresponding intrinsic operators .ge., .gt., .le., and [char46]lt., in that the latter use the processor’s character ordering (which is not ASCII on some targets), whereas the former always use the ASCII ordering.

OPTIONS

o STRING_A : string to be tested
o STRING_B : string to compare to STRING_A

RESULT

Returns .true. if string_a > string_b, and .false. otherwise, based on the ASCII ordering.

If both input arguments are null strings, .false. is returned.

If either string contains a character not in the ASCII character set, the result is processor dependent.

EXAMPLES

Sample program:

    program demo_lgt
    implicit none
    integer :: i
       print *,’the ASCII collating sequence for printable characters’
       write(*,’(1x,19a)’)(char(i),i=32,126)

write(*,*) lgt(’abc’,’ABC’) ! [T] lowercase is > uppercase write(*,*) lgt(’abc’,’abc ’) ! [F] trailing spaces

! If both strings are of zero length the result is false. write(*,*) lgt(’’,’’) ! [F] write(*,*) lgt(’’,’a’) ! [F] the null string is padded write(*,*) lgt(’a’,’’) ! [T] write(*,*) lgt(’abc’,[’abc’,’123’]) ! [F T] scalar and array write(*,*) lgt([’cba’, ’123’],’abc’) ! [T F] write(*,*) lgt([’abc’,’123’],[’cba’,’123’]) ! [F F] both arrays end program demo_lgt

Results:

     >  the ASCII collating sequence for printable characters
     >   !"#$%&’()*+,-./012
     >  3456789:;<=>?@ABCDE
     >  FGHIJKLMNOPQRSTUVWX
     >  YZ[\]^_‘abcdefghijk
     >  lmnopqrstuvwxyz{|}~
     >  T
     >  F
     >  F
     >  F
     >  T
     >  F T
     >  T F
     >  F F

STANDARD

FORTRAN 77

SEE ALSO

LGE(3), LLE(3), LLT(3)

Functions that perform operations on character strings, return lengths of arguments, and search for certain arguments:
o ELEMENTAL: ADJUSTL(3), ADJUSTR(3), INDEX(3),
SCAN(3), VERIFY(3)
o NONELEMENTAL: LEN_TRIM(3), LEN(3), REPEAT(3), TRIM(3)
fortran-lang intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 lgt (3fortran) April 28, 2024
Generated by manServer 1.08 from 8c1325d6-ee8c-4697-8a21-4e57f55fc31c using man macros.