C+ C NAME: C LocLast C PURPOSE: C Find the last occurrence of string cFnd in string cStr C CALLING SEQUENCE: function LocLast(cFnd,cStr) C INPUTS: C cFnd character*(*) string to be searched for C cStr character*(*) string to be searched C OUTPUTS: C L integer position of first/last occurrence, or C 0 if cFnd not found C PROCEDURE: C > The index function has the quirky property that it returns 1 when C searching for a zero-length string, i.e. C I = index('abcd',str(:0)) will set I = 1. C LocLast will return 0 instead. C MODIFICATION HISTORY: C JUL-1995, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- character cFnd*(*) character cStr*(*) NextFnd() = index(cStr(LocLast+1:),cFnd) LocLast = 0 if (len(cFnd) .eq. 0) return ! index(cStr,cFnd(:0)) = 1 NextLoc = NextFnd() do while (NextLoc .ne. 0) LocLast = LocLast+NextLoc NextLoc = NextFnd() end do return end