Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

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

      From cppreference.com
      <cpp‎ |experimental‎ |fs‎ |path
       
       
       
      Filesystem library
      Classes
      Functions
      File types
       
      path
      Member functions
      Path decomposition
      Non-member functions
       
      path stem()const;
      (filesystem TS)

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

      Returns the substring from the beginning offilename() up to and not including the last period (.) character.

      If the filename is one of the special filesystem componentsdot ordot-dot, or if it has no periods, the function returns the entirefilename().

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      The stem of the filename identified by the path.

      [edit]Exceptions

      May throw implementation-defined exceptions.

      [edit]Example

      Run this code
      #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';}

      Output:

      "bar"""".tar"".baz"".bar"

      [edit]See also

      returns the filename path component
      (public member function)[edit]
      returns the file extension path component
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/fs/path/stem&oldid=154888"

      [8]ページ先頭

      ©2009-2025 Movatter.jp