33 lines
763 B
Markdown
33 lines
763 B
Markdown
# ResourcePath::GetStem
|
||
|
||
```cpp
|
||
Containers::String GetStem() const
|
||
```
|
||
|
||
获取文件名(不含扩展名)。
|
||
|
||
**详细描述:**
|
||
|
||
返回路径中文件名部分,不包含扩展名。兼容 Windows (`\`) 和 Unix (`/`) 路径分隔符。
|
||
|
||
**返回:** `Containers::String`,文件名(不含扩展名)
|
||
|
||
**复杂度:** O(n),n 为路径长度
|
||
|
||
**示例:**
|
||
|
||
```cpp
|
||
ResourcePath path("textures/player.png");
|
||
Containers::String stem = path.GetStem(); // "player"
|
||
|
||
ResourcePath path2("textures/player.backup.png");
|
||
Containers::String stem2 = path2.GetStem(); // "player.backup"
|
||
|
||
ResourcePath path3("textures");
|
||
Containers::String stem3 = path3.GetStem(); // "textures"
|
||
```
|
||
|
||
## 相关文档
|
||
|
||
- [ResourcePath 总览](resourcepath.md) - 返回类总览
|