COSMOS v7.655  COSMOSv7655
(AirShowerMC)
c2lowerCase.f
Go to the documentation of this file.
1 !c test c2lowerCase
2 ! character*15 cu/'Ab~} C-_De'/
3 ! character*15 cl/'Xc~+D-_DE'/
4 ! write(*, *) cu, cl, '/'
5 ! call c2lowerCase(cu, cl)
6 ! write(*, *) cu, cl, '/'
7 ! call c2upperCase(cl, cu)
8 ! write(*, *) cl, cu, '/'
9 ! end
10  subroutine c2lowercase(cu, cl)
11 !
12 ! convert [A-Z] in "cu" into [a-z] and put it in "cl"
13 ! This is for standard ASCII.
14 !
15 ! cu: character string. input
16 ! cl: // . output. cl may be cu.
17 !
18 ! if cl is shorter than cu, overflowing part
19 ! is not moved.
20 !
21  implicit none
22  character*(*) cu, cl
23 !
24  integer i, ic, imax
25 !
26 
27  imax = min(len(cu), len(cl))
28  do i = 1, imax
29  ic = ichar( cu(i:i) )
30  if( ic .ge. 65 .and. ic .le. 90 ) then ! A-Z
31  cl(i:i) = char(ic+32)
32  else
33  cl(i:i) = cu(i:i)
34  endif
35  enddo
36  end
37  subroutine c2uppercase(cl, cu)
38 !
39 ! convert [a-z] in "cl" into [A-Z] and put it in "cu"
40 ! This is for standard ASCII.
41 !
42 ! cl: character string. input
43 ! cu: // . output. cu may be cl.
44 !
45 ! if cu is shorter than cl, overflowing part
46 ! is not moved.
47 !
48  implicit none
49  character*(*) cl, cu
50 !
51  integer i, ic, imax
52 !
53 
54  imax = min(len(cu), len(cl))
55  do i = 1, imax
56  ic = ichar( cl(i:i) )
57  if( ic .ge. 97 .and. ic .le. 122 ) then ! a-z
58  cu(i:i) = char(ic-32)
59  else
60  cu(i:i) = cl(i:i)
61  endif
62  enddo
63  end
64 
subroutine c2uppercase(cl, cu)
Definition: c2lowerCase.f:38
subroutine c2lowercase(cu, cl)
Definition: c2lowerCase.f:11