std::experimental::filesystem::path::stem

Returns the filename identified by the path stripped of its extension.

# Declarations

path stem() const;

(filesystem TS)

# Return value

The stem of the filename identified by the path.

# Example

#include <experimental/filesystem>
#include <iostream>
namespace fs = std::experimental::filesystem;
 
int main()
{
    std::cout << fs::path("/foo/bar.txt").stem() << '\n'
              << fs::path("/foo/.bar").stem() << '\n';
 
    for (fs::path p = "foo.bar.baz.tar"; !p.extension().empty(); p = p.stem())
        std::cout << p.extension() << '\n';
}

# See also