19 lines
425 B
Go
19 lines
425 B
Go
|
package stringcv
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
// GetFilenameFromUrl convert url to filename.
|
||
|
func GetFilenameFromUrl(url string) string {
|
||
|
url_els := strings.Split(url, "/")
|
||
|
return url_els[len(url_els)-1]
|
||
|
}
|
||
|
|
||
|
// RenameFile changes filename.
|
||
|
func RenameFile(old_filename, new_name string) string {
|
||
|
old_file_els := strings.Split(old_filename, ".")
|
||
|
return fmt.Sprintf("%s.%s", new_name, old_file_els[len(old_file_els)-1])
|
||
|
}
|