COSMOS v7.655  COSMOSv7655
(AirShowerMC)
klena.f
Go to the documentation of this file.
1 ! ***************************************************************
2 ! * *
3 ! * klena: actual length of character string
4 ! * *
5 ! ********************** tested. 87.01.16*******************k.k**
6 !
7 ! /usage/ l=klena(cha)
8 ! e.g. character*10 cha
9 ! cha='ab c d'
10 ! call sub(cha)
11 ! ....
12 ! subroutine sub(cha)
13 ! character*(*) cha
14 ! l=klena(cha)
15 ! l will be 6
16 ! note: if no character dec. is given for string, klena=0 will
17 ! result. e.g. a='abc', klena(a). but klena('abc') is ok.
18 !
19  integer function klena(cha)
20  implicit none
21  character*(*) cha
22  integer l
23 
24  l=len(cha)
25 
26  if(l <= 0 .or. cha == " " ) then
27  klena=0
28  else
29  do while (cha(l:l) .eq. ' ')
30  l=l-1
31  enddo
32  klena=l
33  endif
34  end
integer function klena(cha)
Definition: klena.f:20