getExt returns the extension of the file(including extensions with `.` in them) from the given url.
(path string)
| 123 | |
| 124 | // getExt returns the extension of the file(including extensions with `.` in them) from the given url. |
| 125 | func getExt(path string) string { |
| 126 | ext := "" |
| 127 | for i := len(path) - 1; i >= 0 && !os.IsPathSeparator(path[i]); i-- { |
| 128 | if path[i] == '.' { |
| 129 | ext = path[i:] |
| 130 | } |
| 131 | } |
| 132 | return ext |
| 133 | } |