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 >
Wrap
Text File
|
1991-07-25
|
932b
|
29 lines
*
* STRIPEXT - Strip the extension from a file name.
*
* Description:
* Use the algorithm employed by FoxPRO itself to strip a
* file of an extension (if any): Find the rightmost dot in
* the filename. If this dot occurs to the right of a "\"
* or ":", then treat everything from the dot rightward
* as an extension. Of course, if we found no dot,
* we just hand back the filename unchanged.
*
* Parameters:
* filename - character string representing a file name
*
* Return value:
* The string "filename" with any extension removed
*
* This procedure courtesy of Fox Software
* Modified to use naming conventions
FUNCTION stripext
PARAMETER m.lcFileName
PRIVATE m.lndotpos, m.lnTermintr
m.lndotpos = RAT(".", m.lcFileName)
m.lnTermintr = MAX(RAT("\", m.lcFileName), RAT(":", m.lcFileName))
IF m.lndotpos > m.lnTermintr
m.lcFileName = LEFT(m.lcFileName, m.lndotpos-1)
ENDIF
RETURN m.lcFileName