home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / p / projman1.zip / STRIPEXT.PRG < prev    next >
Text File  |  1991-07-25  |  932b  |  29 lines

  1. *
  2. * STRIPEXT - Strip the extension from a file name.
  3. *
  4. * Description:
  5. * Use the algorithm employed by FoxPRO itself to strip a
  6. * file of an extension (if any): Find the rightmost dot in
  7. * the filename.  If this dot occurs to the right of a "\" 
  8. * or ":", then treat everything from the dot rightward
  9. * as an extension.  Of course, if we found no dot,
  10. * we just hand back the filename unchanged.
  11. *
  12. * Parameters:
  13. * filename - character string representing a file name
  14. *
  15. * Return value:
  16. * The string "filename" with any extension removed 
  17. *
  18. * This procedure courtesy of Fox Software
  19. *  Modified to use naming conventions
  20. FUNCTION stripext
  21. PARAMETER m.lcFileName
  22. PRIVATE m.lndotpos, m.lnTermintr
  23.     m.lndotpos = RAT(".", m.lcFileName)
  24.     m.lnTermintr = MAX(RAT("\", m.lcFileName), RAT(":", m.lcFileName))
  25.     IF m.lndotpos > m.lnTermintr
  26.         m.lcFileName = LEFT(m.lcFileName, m.lndotpos-1)
  27.     ENDIF
  28. RETURN m.lcFileName
  29.