filepath.Ext() Function in Golang With Examples
In Go language, path package used for paths separated by forwarding slashes, such as the paths in URLs. The filepath.Ext() function in Go language used to return the file name extension used by the specified path. The extension is the suffix beginning at the final dot in the final element of path; it is empty if there is no dot. Moreover, this function is defined under the path package. Here, you need to import the “path/filepath” package in order to use these functions.
func Ext(path string) string
Here, ‘path’ is the specified path.
Return Value: It returns the file name extension used by the specified path.
.org . .org
.b .org .cd