lle(3f) - [FORTRAN:INTRINSIC:CHARACTER] Lexical less than or equal
result = lle(STR_A, STR_B)character(len=*),intent(in) :: STR_A, STR_B or character(len=*),intent(in) :: STR_A, STR_B(*) logical :: result
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 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. 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 .lt., in that the latter use the processors character ordering (which is not ASCII on some targets), whereas the former always use the ASCII ordering.
STR_A variable or array of default CHARACTER type. STR_B variable or array of default CHARACTER type. if STR_A and STR_B are both arrays they must be of the same shape.
RESULT Returns .TRUE. if STR_A <= STR_B, and .FALSE. otherwise, based on the ASCII ordering.
Sample program:
program demo_lle implicit none integer :: i write(*,(*(a)))(char(i),i=32,126) write(*,*) lle(abc,ABC) ! F lowercase is > uppercase write(*,*) lle(abc,abc ) ! T trailing spaces ! 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 write(*,*) lle(abc,[abc,123]) ! [T,F] scalar and array write(*,*) lle([cba, 123],abc) ! [F,T] write(*,*) lle([abc,123],[cba,123]) ! [T,T] both arrays end program demo_lle
Results:
> !"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ > [\]^_abcdefghijklmnopqrstuvwxyz{|}~ > F > T > T > T > F > T F > F T > T T
[[FORTRAN 77]] and later
[[Elemental procedure|Elemental function]]
lge(3), lgt(3), llt(3)Functions that perform operations on character strings, return lengths of arguments, and search for certain arguments:
Elemental: adjustl(3), adjustr(3), index(3), len_trim(3), scan(3), verify(3) Nonelemental: repeat(3), trim(3)
lle (3) | March 11, 2021 |