root / src / upcase.f90 @ 3
Historique | Voir | Annoter | Télécharger (479 octet)
| 1 | 1 | pfleura2 | SUBROUTINE Upcase(String) |
|---|---|---|---|
| 2 | 1 | pfleura2 | |
| 3 | 1 | pfleura2 | ! This subroutine converts a string into its Upcase |
| 4 | 1 | pfleura2 | ! version |
| 5 | 1 | pfleura2 | |
| 6 | 2 | pfleura2 | IMPLICIT NONE |
| 7 | 2 | pfleura2 | |
| 8 | 1 | pfleura2 | integer, parameter :: KINT = kind(1) |
| 9 | 1 | pfleura2 | |
| 10 | 1 | pfleura2 | CHARACTER(*), INTENT(INOUT) :: String |
| 11 | 1 | pfleura2 | INTEGER(KINT) :: i,ic, length |
| 12 | 1 | pfleura2 | length=len_trim(string) |
| 13 | 1 | pfleura2 | DO I=1, length |
| 14 | 1 | pfleura2 | ic=ICHAR(String(i:i)) |
| 15 | 1 | pfleura2 | if ((ic.ge.97).and.(ic.le.122)) ic=ic-32 |
| 16 | 1 | pfleura2 | String(i:i)=ACHAR(ic) |
| 17 | 1 | pfleura2 | END DO |
| 18 | 1 | pfleura2 | |
| 19 | 1 | pfleura2 | RETURN |
| 20 | 1 | pfleura2 | END SUBROUTINE Upcase |