1!$Id:$
2      subroutine just(y,nt,n0)
3
4!      * * F E A P * * A Finite Element Analysis Program
5
6!....  Copyright (c) 1984-2017: Regents of the University of California
7!                               All rights reserved
8
9!-----[--.----+----.----+----.-----------------------------------------]
10!      Purpose: Justify alphanumeric data in a string:
11!               - Numbers are right justified
12!               - Alphanumerics remain left justified
13
14!      Inputs:
15!         y*(*) - Unjustified string of data
16!         nt    - Length of string
17!         n0    - Field width for justification
18
19!      Outputs:
20!         y*(*) - Justified string of data
21!-----[--.----+----.----+----.-----------------------------------------]
22
23      implicit  none
24
25      integer   nt,n0,n1,i,j,l,nl
26      character y*(*)
27
28      save
29
30      n1 = n0 - 1
31      do i = 1,nt,n0
32
33!       Find last non-blank character in string
34
35        do j = i,i+n1
36          if(y(j:j).ne.' ') go to 100
37        end do
38        y(i+n1:i+n1) = '0'
39100     if(y(i+n1:i+n1).eq.' ') then
40
41!         Identify a number in field and right justify
42
43          if((y(i:i).ge.'0'.and.y(i:i).le.'9')
44     &                    .or. (y(i:i).eq.'-')
45     &                    .or. (y(i:i).eq.'+')
46     &                    .or. (y(i:i).eq.'.')) then
47            do j = i+n1-1,i,-1
48              if(y(j:j).ne.' ') go to 110
49            end do
50110         nl = n1 + i - j
51            do l = j,i,-1
52              y(l+nl:l+nl) = y(l:l)
53              y(l:l)       = ' '
54            end do
55          endif
56        endif
57      end do
58
59      end
60