|
//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
dotweb/framework/file/file.go
Lines 19 to 31 in 129df76
可以使用 Golang 自带的
func filepath.Ext(name string) string代替框架中的获取文件扩展名方法func GetFileExt(fileName string) string