Skip to content

Use filepath.Ext to replace file.GetFileExt #99

@oopsguy

Description

@oopsguy

//get filename extensions
func GetFileExt(fileName string) string {
if fileName == "" {
return ""
} else {
index := strings.LastIndex(fileName, ".")
if index < 0 {
return ""
} else {
return string(fileName[index:])
}
}
}

可以使用 Golang 自带的 func filepath.Ext(name string) string 代替框架中的获取文件扩展名方法 func GetFileExt(fileName string) string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions