package stringx import "strings" func ReplaceSuffix(s string, suffix string, newSuffix string) (string, bool) { if strings.HasSuffix(s, suffix) { replaced := s[:len(s)-len(suffix)] + newSuffix return replaced, true } return s, false }