by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 5.0, Creation date: 2021-02-19, Last change: 2025-09-15
See Also:
fn=filepartl(fname,[fmt])
fname: | original file name | |
fmt: | 'e' if extension should be added; 'p' if path should be added |
fn: | filename |
filepartl('/Users/timlueth/Desktop/Book.pdf')
filepartl('/Users/timlueth/Desktop/Book.pdf','p')
filepartl('/Users/timlueth/Desktop/Book.pdf','pe')
filepartl('/Users/timlueth/Desktop/Book.pdf','e')
This function, filepartl, is designed to compile a filename from its parts, similar to the built-in fileparts function in MATLAB. It is part of the SolidGeometry library and was introduced in version 5.0.
fmt using the helper function getfuncparams. If fmt is not provided, it defaults to 'n'.fileparts function is used to split the input fname into three components:
fp - the file path.fn - the file name without the extension.fe - the file extension.fmt contains 'p' (case-insensitive). If it does, the file path fp is concatenated with the file name fn, separated by the system's file separator filesep.fmt contains 'e' (case-insensitive). If it does, the file extension fe is appended to the file name fn.fn is returned as the output.filepartl('/Users/timlueth/Desktop/Book.pdf') - Returns 'Book' (default behavior without 'p' or 'e').filepartl('/Users/timlueth/Desktop/Book.pdf','p') - Returns '/Users/timlueth/Desktop/Book'.filepartl('/Users/timlueth/Desktop/Book.pdf','pe') - Returns '/Users/timlueth/Desktop/Book.pdf'.filepartl('/Users/timlueth/Desktop/Book.pdf','e') - Returns 'Book.pdf'.