directory and with an optional suffix chopped off.
If suffix is specified, it will be compared to path using filenameCmp!cs, where cs is an optional template parameter determining whether the comparison is case sensitive or not. See the
auto baseName(R)(return scope R path) if (isRandomAccessRange!R && hasSlicing!R && isSomeChar!(ElementType!R) && !isSomeString!R)cs | Whether or not suffix matching is case-sensitive. |
path | A path name. It can be a string, or any random-access range of characters. |
suffix | An optional suffix to be removed from the file name. |
directory and with an optional suffix chopped off.
If suffix is specified, it will be compared to path using filenameCmp!cs, where cs is an optional template parameter determining whether the comparison is case sensitive or not. See the
doesn't necessarily have to represent an extension. To remove the extension from a path, regardless of what the extension is, use stripExtension. To obtain the filename without leading directories and without an extension, combine the functions like this:
assert(baseName(stripExtension("dir/file.ext")) == "file");(with suitable adaptations for Windows paths).
auto baseName(C)(return scope C[] path) if (isSomeChar!C)ditto
inout(C)[] baseName(CaseSensitive cs = CaseSensitive.osDefault, C, C1)(return scope inout(C)[] path, in C1[] suffix) if (isSomeChar!C && isSomeChar!C1) @safe pureditto