COSMOS v7.655  COSMOSv7655
(AirShowerMC)
ksplit.f
Go to the documentation of this file.
1  subroutine ksplit(a, m, n, b, nr)
2  implicit none
3  character*(*) a ! input. e.g abc xyz xxkxkxkk
4  integer m ! input. max characters containable in b(i)
5  integer n ! input. array size of b
6  character*(*) b(n) ! output. field value of i=1,2,...nr
7  integer nr ! output. nr field is obtained
8 
9  integer klena, tl, bp, i, nc
10  character*1 prev
11 
12  tl = klena(a)
13 
14  nr = 0
15  prev = ' '
16  do i = 1, tl
17  if( a(i:i) .eq. ' ' ) then
18  prev = ' '
19  else
20  if(prev .eq. ' ') then
21  if(nr .ge. n) return !!!!
22  nr = nr + 1
23  nc = 0
24  prev = 'x'
25  endif
26  nc = nc + 1
27  if(nc .eq. 1) b(nr) = ' '
28  if(nc .le. m) then
29  b(nr)(nc:nc) = a(i:i)
30  endif
31  endif
32  enddo
33  end
subroutine ksplit(a, m, n, b, nr)
Definition: ksplit.f:2