| 1 |
# lge(x, y): Lexically Greater or Equal |
| 2 |
|
| 3 |
Lexically greater than or equal. |
| 4 |
|
| 5 |
## Declaration |
| 6 |
|
| 7 |
|
| 8 |
### Syntax |
| 9 |
|
| 10 |
```fortran |
| 11 |
retval = lge(x, y) |
| 12 |
function lge(x, y) |
| 13 |
``` |
| 14 |
|
| 15 |
### Arguments |
| 16 |
|
| 17 |
`x` input value of type character. |
| 18 |
|
| 19 |
`y` input value of type character. |
| 20 |
|
| 21 |
`x` and `y` can be seen as string A and string B. |
| 22 |
|
| 23 |
### Return values |
| 24 |
|
| 25 |
The return value is of logical `true` or `false` type. |
| 26 |
|
| 27 |
`True` if `x` string is lexically greater than or equal to `y`. |
| 28 |
|
| 29 |
`False` if they are not. |
| 30 |
|
| 31 |
## Description |
| 32 |
|
| 33 |
**lge(x, y)** determines if input string `x` is lexically greater than or equal |
| 34 |
to input string `y`. The two strings in comparison are interpreted as |
| 35 |
containing ASCII character codes. |
| 36 |
|
| 37 |
## Types |
| 38 |
|
| 39 |
Argument types should be of type character literal. |
| 40 |
|
| 41 |
```fortran |
| 42 |
module lfortran_intrinsic_string |
| 43 |
use, intrinsic :: iso_fortran_env, only: i64 => int64 |
| 44 |
implicit none |
| 45 |
|
| 46 |
interface repeat |
| 47 |
module procedure repeati32, repeati64 |
| 48 |
end interface |
| 49 |
|
| 50 |
contains |
| 51 |
|
| 52 |
function lge(x, y) result(r) |
| 53 |
character(len=*),intent(in) :: x |
| 54 |
character(len=*),intent(in) :: y |
| 55 |
logical :: r |
| 56 |
end function |
| 57 |
``` |
| 58 |
|
| 59 |
## Examples |
| 60 |
|
| 61 |
```fortran |
| 62 |
program intrinsics_lge |
| 63 |
implicit none |
| 64 |
character(len = 10) :: s1 = 'abcde' |
| 65 |
character(len = 10) :: s2 = 'xyz' |
| 66 |
character(len = 10) :: s3 = 'AB' |
| 67 |
character(len = 10) :: s4 = 'AAB' |
| 68 |
print *, lge(s1, s2) |
| 69 |
end program |
| 70 |
``` |
| 71 |
|
| 72 |
**Result:** |
| 73 |
|
| 74 |
``` |
| 75 |
false |
| 76 |
true |
| 77 |
``` |
| 78 |
|
| 79 |
## See Also |
| 80 |
|
| 81 |
[len_trim](len_trim.md). |