生命不止,继续 go go go !!!
文件以及文件夹的路径在编程中经常遇到,在C++工程中,我们往往自己写一个文件,里面塞满了关于路径的操作。
golang很好,为我们提供了path/filepath包,方便极了。
import “path/filepath”
作用:
Package filepath implements utility routines for manipulating filename paths in a way compatible with the target operating system-defined file paths.
常量
const (
Separator = os.PathSeparator
ListSeparator = os.PathListSeparator
)
ToSlash
func ToSlash(path string) string