ncmdump-go/utils/file.go

12 lines
204 B
Go
Raw Normal View History

2024-09-14 22:39:50 +08:00
package utils
import (
"path/filepath"
"strings"
)
func ReplaceExtension(filepathStr, newExt string) string {
ext := filepath.Ext(filepathStr)
return strings.TrimSuffix(filepathStr, ext) + newExt
}