home *** CD-ROM | disk | FTP | other *** search
- /*
- ** GetNumExtension
- **
- ** $VER: GetNumExtension 1.1.0 (5.11.93)
- **
- ** This function separates the number from a FRED-created filename.
- **
- ** Copyright © 1992-1993 ASDG, Incorporated
- ** All Rights Reserved
- */
-
-
- GetNumExtension:
- PARSE ARG name
-
- offset = 1
- continue = 0
- havenumber = 0
- numletters = 0
- DO WHILE (continue = 0)
- IF ((pos = INDEX( name, '.' )) ~= 0) THEN
- DELSTR( name, pos, 1 )
- ELSE
- continue = 1
- END
-
- continue = 0
- DO WHILE (continue = 0)
- test = LEFT( name, LENGTH( name ) - ( offset - 1 ))
- IF (DATATYPE( RIGHT( test, 1 )) = 'NUM' ) THEN DO
- offset = offset + 1
- havenumber = 1
- END
- ELSE DO
- IF (havenumber = 1) THEN DO
- IF (numletters = 0) THEN
- ext = RIGHT( name, offset - 1 )
- ELSE DO
- test = LEFT( name, LENGTH( name ) - numletters )
- ext = RIGHT( test, ( offset - numletters - 1 ))
- END
- continue = 1
- END
- ELSE DO
- offset = offset + 1
- numletters = numletters + 1
- END
- END
- END
-
- RETURN ext
-