I have trivial question.
I have string which contains a filename and it\'s path. How can i remove whole path? I have tried those:
line = \"/some/pat
The number is the index of the last slash in the string. If you want to get the file's base name, use filepath.Base:
path := "/some/path/to/remove/file.name" file := filepath.Base(path) fmt.Println(file)
Playground: http://play.golang.org/p/DzlCV-HC-r.