C+ C NAME: C icompress C PURPOSE: C Remove spaces,tabs,nulls; returns length of remaining string C CATEGORY: C String manipulation C CALLING SEQUENCE: function icompress(cStr,cOut) C INPUTS: C cStr character*(*) string to be processed C OUTPUTS: C cOut character*(*) modified string C icompress integer length non-trivial part of output string C SEE ALSO: C uppercase, lowercase, itrim, iwhitespace, bCompareStr C RESTRICTIONS: C The string is only tested for space, tab and null C PROCEDURE: C Each character in the string is converted separately. C MODIFICATION HISTORY: C JAN-1992, Paul Hick (UCSD); check for NULL added (some system procedures C pad strings with NULs instead of blanks) C- character cStr*(*) character cOut*(*) integer NUL / 0/ integer TAB / 9/ integer SP /32/ logical bNoChar bNoChar(I) = cStr(I:I) .eq. char(SP) .or. cStr(I:I) .eq. char(NUL) .or. cStr(I:I) .eq. char(TAB) L = len(cStr) N = len(cOut) J = 1 do I=1,L if (.not. bNoChar(I) .and. J .le. N) then cOut(J:J) = cStr(I:I) ! Copy valid chars J = J+1 end if end do if (J .le. N) cOut(J:N) = ' ' icompress = J-1 return end