C+ C NAME: C itrim C PURPOSE: C Returns the index of the last non-blank character in a string C CATEGORY: C String manipulation C CALLING SEQUENCE: function itrim(cStr) C INPUTS: C cStr character*(*) string to be processed C OUTPUTS: C itrim integer length non-trivial part of output string C SEE ALSO: C uppercase, lowercase, icompress, 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*(*) 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) itrim = len(cStr) if (itrim .eq. 0) return ! Zero-length string do while (bNoChar(itrim)) ! Check back to front itrim = itrim-1 if (itrim .eq. 0) return ! Empty string end do return end