V3FIT
tolower.f90
1  SUBROUTINE tolower(string)
2 ! convert a string to lower case
3 ! note: string should NOT be a parameter (constant) or this seg faults
4  CHARACTER (len=*) , INTENT(inout) :: string
5  INTEGER :: i,ic,nlen,icLow,icHigh,icDel
6 
7  iclow = ichar('A')
8  ichigh = ichar('Z')
9  icdel = ichar('a') - ichar('A')
10  nlen = len(string)
11  DO i=1,nlen
12  ic = ichar(string(i:i))
13  IF (ic >= iclow .and. ic < ichigh) string(i:i) = char(ic+icdel)
14  END DO
15 
16  END SUBROUTINE tolower