2021
06-13
06-13
Go语言获取文件的名称、前缀、后缀
示例代码:packagemainimport("fmt""path")funcmain(){filename:="device/sdk/CMakeLists.txt"filenameall:=path.Base(filename)filesuffix:=path.Ext(filename)fileprefix:=filenameall[0:len(filenameall)-len(filesuffix)]//fileprefix,err:=strings.TrimSuffix(filenameall,filesuffix)fmt.Println("filename:",filenameall)fmt.Println("fileprefix:",filepre...
继续阅读 >