std::experimental::filesystem::path:: stem
From cppreference.net
<
cpp
|
experimental
|
fs
|
path
C++
Experimental
| Technical Specification | ||||
| Filesystem library (filesystem TS) | ||||
| Library fundamentals (library fundamentals TS) | ||||
| Library fundamentals 2 (library fundamentals TS v2) | ||||
| Library fundamentals 3 (library fundamentals TS v3) | ||||
| Extensions for parallelism (parallelism TS) | ||||
| Extensions for parallelism 2 (parallelism TS v2) | ||||
| Extensions for concurrency (concurrency TS) | ||||
| Extensions for concurrency 2 (concurrency TS v2) | ||||
| Concepts (concepts TS) | ||||
| Ranges (ranges TS) | ||||
| Reflection (reflection TS) | ||||
| Mathematical special functions (special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
Filesystem library
| Classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
path
| Member functions | ||||
| Path decomposition | ||||
| Non-member functions | ||||
|
path stem
(
)
const
;
|
(文件系统 TS) | |
返回路径所标识的文件名并去除其扩展名。
返回从
filename()
起始到最后一个点号(
.
)字符之前(不包含该字符)的子字符串。
如果文件名是特殊文件系统组件 点 或 点点 之一,或者文件名中不包含句点,该函数将返回完整的 filename() 。
目录 |
参数
(无)
返回值
路径所标识文件名的核心部分。
异常
可能抛出实现定义的异常。
示例
运行此代码
#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'; }
输出:
"bar" "" ".tar" ".baz" ".bar"
参见
|
返回文件名路径组件
(公开成员函数) |
|
|
返回文件扩展名路径组件
(公开成员函数) |