gitee.com/zhongguo168a/gocodes@v0.0.0-20230609140523-e1828349603f/gox/pathx/filepathx/path.go (about) 1 package filepathx 2 3 import ( 4 "path/filepath" 5 "strings" 6 ) 7 8 // Name 获取指定路径的名字 9 // dir/[Name].ext 10 func Name(path string) (r string) { 11 r = filepath.Base(path) 12 ext := filepath.Ext(path) 13 if ext != "" { 14 r = strings.Replace(r, ext, "", -1) 15 } 16 return 17 }