Gets the extension of a file

Gets the extension



Gets the extension of a file by returning all characters behind (excluding) the last dot (.)

@param TARGET_FILE The file to return the extension of

@return A string value, containing the extension (file format) of the given file

Funprog GET_FILE_EXTENSION(TARGET_FILE) Value Char TARGET_FILE Local Char FILEEXT(10) Local Integer LASTDOT_POS : LASTDOT_POS = 0 While instr(LASTDOT_POS + 1, TARGET_FILE, ".") <> 0 LASTDOT_POS = instr(LASTDOT_POS + 1, TARGET_FILE, ".") Wend FILEEXT = seg$(TARGET_FILE, LASTDOT_POS + 1, len(TARGET_FILE)) End FILEEXT