get_file_base

Definition: string base = get_file_base(string filename)
Description: Extract the base portion of a file name.

filename: the [path and] filename from which to extract information.

Returns a string, the part of filename up to the first '.'.
Comments: The base part of the filename is that up to the first '.', or the full filename if there is none.

Like get_file_name, but unlike get_file_extension, the case of the returned value matches the actual case of the file, if it exists, otherwise it matches the supplied string.

Note that, even ignoring case considerations, base&"."&extension is not necessarily the same as filename - in the last two examples below there would be a missing ".3.1" and ".part" respectively.

Both forwardslash ('/') and backslash ('\\') are handled for all platforms.
Examples:
?get_file_base("C:/Program Files (x86)/Phix/builtins/vm/papnd.e")   -- displays "pApnd"
?get_file_base("libglfw.so.3.1")                                    -- displays "libglfw"
?get_file_base("test.part.txt")                                     -- displays "test"
See Also: get_file_name, get_file_extension