Line data Source code
1 0 : subroutine rjusty(text) 2 : C 3 : C A.J. Hunt - August, 1981 4 : C H.May - Feb 1994 - modified to work correctly under unix. 5 : C N.Killeen - Mar 1994 - declared variable i 6 : C 7 : C call rjusty (text) 8 : C 9 : C RJUSTY is a subroutine for right justifying a text string 10 : C (i.e. removing the trailing spaces and shifting them to 11 : C the beginning). 12 : 13 : character *(*) text 14 : integer lastsp, NCHAR, ist, i 15 : 16 0 : if (text .eq. ' ') return 17 0 : if (len(text) .eq. nchar(text)) return 18 : 19 0 : lastsp = LEN (text) - NCHAR (text) 20 0 : ist = lastsp + 1 21 : 22 0 : do i = len(text),ist,-1 23 0 : text(i:i) = text(i-lastsp:i-lastsp) 24 : end do 25 : C text(ist:) = text 26 0 : if (lastsp .ge. 1) text (:lastsp) = ' ' 27 : 28 0 : return 29 0 : end