docs: update resources API docs
This commit is contained in:
32
docs/api/resources/resourcepath/getextension.md
Normal file
32
docs/api/resources/resourcepath/getextension.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# ResourcePath::GetExtension
|
||||
|
||||
```cpp
|
||||
Containers::String GetExtension() const
|
||||
```
|
||||
|
||||
获取文件扩展名。
|
||||
|
||||
**详细描述:**
|
||||
|
||||
返回路径字符串的文件扩展名部分,包括前缀点(`.`)。如果路径为空或不包含扩展名,返回空字符串。
|
||||
|
||||
**返回:** `Containers::String`,包含扩展名(如 `".png"`),如果无扩展名则返回空字符串
|
||||
|
||||
**复杂度:** O(n),n 为路径长度
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
ResourcePath path("textures/player.png");
|
||||
Containers::String ext = path.GetExtension(); // ".png"
|
||||
|
||||
ResourcePath path2("textures/player");
|
||||
Containers::String ext2 = path2.GetExtension(); // ""
|
||||
|
||||
ResourcePath path3("");
|
||||
Containers::String ext3 = path3.GetExtension(); // ""
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [ResourcePath 总览](resourcepath.md) - 返回类总览
|
||||
Reference in New Issue
Block a user