Use strings.ReplaceAll instead of strings.Replace(…, -1)

This commit is contained in:
jvoisin 2024-02-29 00:29:35 +01:00 committed by Frédéric Guillot
parent 4fe902a5d2
commit fa12c23d79
2 changed files with 2 additions and 2 deletions

View file

@ -156,7 +156,7 @@ func (d *Description) HTML() string {
return d.Description return d.Description
} }
content := strings.Replace(d.Description, "\n", "<br>", -1) content := strings.ReplaceAll(d.Description, "\n", "<br>")
return textLinkRegex.ReplaceAllString(content, `<a href="${1}">${1}</a>`) return textLinkRegex.ReplaceAllString(content, `<a href="${1}">${1}</a>`)
} }

View file

@ -302,7 +302,7 @@ func replaceTextLinks(input string) string {
} }
func replaceLineFeeds(input string) string { func replaceLineFeeds(input string) string {
return strings.Replace(input, "\n", "<br>", -1) return strings.ReplaceAll(input, "\n", "<br>")
} }
func replaceCustom(entryContent string, searchTerm string, replaceTerm string) string { func replaceCustom(entryContent string, searchTerm string, replaceTerm string) string {