home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / p / projman1.zip / STRIPPAT.PRG < prev    next >
Text File  |  1991-05-27  |  984b  |  34 lines

  1.  
  2. *
  3. * STRIPPATH - Strip the path from a file name.
  4. *
  5. * Description:
  6. * Find positions of backslash in the name of the file.  If there is one 
  7. * take everything to the right of its position and make it the new file 
  8. * name.  If there is no slash look for colon.  Again if found, take 
  9. * everything to the right of it as the new name.  If neither slash
  10. * nor colon are found then return the name unchanged.
  11. *
  12. * Parameters:
  13. * filename - character string representing a file name
  14. *
  15. * Return value:
  16. * The string "filename" with any path removed
  17. *
  18. FUNCTION strippat
  19. PARAMETER m.filename
  20. PRIVATE m.slashpos, m.namelen, m.colonpos
  21.     m.slashpos = RAT("\", m.filename)
  22.     IF m.slashpos <> 0
  23.         m.namelen  = LEN(m.filename) - m.slashpos
  24.         m.filename = RIGHT(m.filename, m.namelen)
  25.     ELSE
  26.         m.colonpos = RAT(":", m.filename)
  27.         IF m.colonpos <> 0
  28.             m.namelen  = LEN(m.filename) - m.colonpos
  29.             m.filename = RIGHT(m.filename, m.namelen)
  30.         ENDIF
  31.     ENDIF
  32. RETURN m.filename
  33.  
  34.