PracticeDev/study_go/test.go

21 lines
473 B
Go
Raw Permalink Normal View History

2022-12-20 17:31:11 +08:00
package main
import (
"fmt"
"strings"
)
func main() {
filePath := "/mnt/data/repo/dists/pimox/pimox_v6/binary-all/ceph-mgr-diskprediction-local_15.2.13-pve1_all.deb"
splitPath := strings.Split(filePath, "/")
archFull := splitPath[len(splitPath)-2]
archSplit := strings.Split(archFull, "-")
distro := splitPath[len(splitPath)-4]
section := splitPath[len(splitPath)-3]
fmt.Println(distro)
fmt.Println(section)
fmt.Println(archSplit[1])
}