Function file_name_extension
Synopsis
#include "breeze/path/file_name_extension.hpp"
std::string file_name_extension(std::string const &path)
Description
- Returns
- The extension of the file name part of
path
, including the period, if any. This is the substring starting from the last period, except that:
- if the file name part is "." or ".." (without quotes) or does not contain a period, the result is an empty string;
- if the file name part begins with a period, then that initial period (and only that) is ignored (so ".dotfile" gives "", while ".dotfile.txt" gives ".txt").
- Note
- This behavior is aligned with that of
std::filesystem::path::extension()
(C++17).
Source
Line 40 in breeze/path/file_name_extension.hpp.