1 Star 0 Fork 0

younland / brick

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
path.go 657 Bytes
一键复制 编辑 原始数据 按行查看 历史
严宇川 提交于 2022-01-06 15:48 . v0.0.1
package xfile
import (
"path"
"strings"
)
// GetFileName ...
func GetFileName(filepath string) string {
return path.Base(filepath)
}
// GetFileNameWithoutExt ...
func GetFileNameWithoutExt(filepath string) string {
return strings.ReplaceAll(path.Base(filepath), path.Ext(filepath), "")
}
// GetFilePathWithoutExt ...
func GetFilePathWithoutExt(filepath string) string {
return GetFileDir(filepath) + "/" + GetFileNameWithoutExt(filepath)
}
// GetFileDir ...
func GetFileDir(filepath string) string {
return path.Dir(filepath)
}
// GetFileExt ...
func GetFileExt(file string) string {
return strings.ToLower(strings.Trim(path.Ext(file), "."))
}
1
https://gitee.com/younland/brick.git
git@gitee.com:younland/brick.git
younland
brick
brick
v1.0.1

搜索帮助

53164aa7 5694891 3bd8fe86 5694891