Extracts the base name (file name without extension) from a file path.
The file path from which to extract the base name.
A boolean flag indicating whether to capitalize the base name. Defaults to false.
false
The base name of the file. The base name will be capitalized if shouldCapitalize is true.
shouldCapitalize
true
getBaseName("example.txt"); // Returns "Example"getBaseName("/path/to/file.jpg"); // Returns "File"getBaseName("file_without_extension", false); // Returns "file_without_extension"getBaseName("", false); // Returns "" Copy
getBaseName("example.txt"); // Returns "Example"getBaseName("/path/to/file.jpg"); // Returns "File"getBaseName("file_without_extension", false); // Returns "file_without_extension"getBaseName("", false); // Returns ""
Extracts the base name (file name without extension) from a file path.