Manual Reference Pages  - lle (3fortran)

NAME

LLE(3) - [CHARACTER:COMPARE] ASCII Lexical less than or equal

SYNOPSIS

result = lle(string_a, stringb)

          elemental logical function lle(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

LLE(3) determines whether one string is lexically less than or equal to another string, where the two strings are interpreted as containing ASCII character codes.

If 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.

Leading spaces are significant.

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 LLE(3) always uses 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 collating sequence.

If both input arguments are null strings, .true. is always returned.

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

EXAMPLES

Sample program:

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

print *,’case matters’ write(*,*) lle(’abc’,’ABC’) ! F lowercase is > uppercase

print *,’a space is the lowest printable character’ write(*,*) lle(’abcd’,’abc’) ! F d > space write(*,*) lle(’abc’,’abcd’) ! T space < d

print *,’leading spaces matter, trailing spaces do not’ write(*,*) lle(’abc’,’abc ’) ! T trailing spaces write(*,*) lle(’abc’,’ abc’) ! F leading spaces are significant

print *,’even null strings are padded and compared’ ! If both strings are of zero length the result is true. write(*,*) lle(’’,’’) ! T write(*,*) lle(’’,’a’) ! T the null string is padded write(*,*) lle(’a’,’’) ! F print *,’elemental’ write(*,*) lle(’abc’,[’abc’,’123’]) ! [T,F] scalar and array write(*,*) lle([’cba’, ’123’],’abc’) ! [F,T] ! per the rules for elemental procedures arrays must be the same size write(*,*) lle([’abc’,’123’],[’cba’,’123’]) ! [T,T] both arrays end program demo_lle

Results:

     >  the ASCII collating sequence for printable characters
     >   !"#$%&’()*+,-./012
     >  3456789:;<=>?@ABCDE
     >  FGHIJKLMNOPQRSTUVWX
     >  YZ[\]^_‘abcdefghijk
     >  lmnopqrstuvwxyz{|}~
     >  case matters
     >  F
     >  a space is the lowest printable character
     >  F
     >  T
     >  leading spaces matter, trailing spaces do not
     >  T
     >  F
     >  even null strings are padded and compared
     >  T
     >  T
     >  F
     >  elemental
     >  T F
     >  F T
     >  T T

STANDARD

FORTRAN 77

SEE ALSO

LGE(3), LGT(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 intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 lle (3fortran) November 02, 2024
Generated by manServer 1.08 from 065022e0-fb5f-4a6b-85c4-b7d1aaadd59e using man macros.