Statistics
| Revision:

root / src / upcase.f90 @ 5

History | View | Annotate | Download (678 Bytes)

1
      SUBROUTINE Upcase(String)
2

    
3
! This subroutine converts a string into its Upcase
4
! version
5

    
6
        IMPLICIT NONE
7

    
8
        integer, parameter :: KINT = kind(1)
9

    
10
        CHARACTER(*), INTENT(INOUT) :: String
11
        INTEGER(KINT) :: i,ic, length,Del,ia,iz
12

    
13
! We define some variables
14
! By doing this, we do not depend on the ASCII coding of the
15
! characters
16
        DEL = IACHAR('a') - IACHAR('A')
17
        ia=IACHAR('a')
18
        iz=IACHAR('z')
19

    
20
        length=len_trim(string)
21
        DO I=1, length
22
          ic=ICHAR(String(i:i))
23
          if ((ic.ge.ia).and.(ic.le.iz)) ic=ic-DEL
24
          String(i:i)=ACHAR(ic)
25
        END DO
26

    
27
        RETURN
28
      END SUBROUTINE Upcase
29