Expand/Shrink

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 '.'.
pwa/p2js: Supported (after all it is only a bit of text extraction).
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 - the last two examples below would respectively be missing ".3.1" and ".part".

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"
Implementation: See builtins\file_utils.e (an autoinclude) for details of the actual implementation.
See Also: get_file_name, get_file_extension
Expand/Shrink