Use strings.Replacer to unescape tags
This commit is contained in:
parent
0085cea5a1
commit
e4d5d2737b
@ -151,11 +151,14 @@ func splitParam(param string) (string, string) {
|
||||
return parts[0], ""
|
||||
}
|
||||
|
||||
var unescapeTagReplacer = strings.NewReplacer(
|
||||
"\\:", ";",
|
||||
"\\s", " ",
|
||||
"\\\\", "\\",
|
||||
"\\r", "\r",
|
||||
"\\n", "\n",
|
||||
)
|
||||
|
||||
func unescapeTag(s string) string {
|
||||
s = strings.Replace(s, "\\:", ";", -1)
|
||||
s = strings.Replace(s, "\\s", " ", -1)
|
||||
s = strings.Replace(s, "\\\\", "\\", -1)
|
||||
s = strings.Replace(s, "\\r", "\r", -1)
|
||||
s = strings.Replace(s, "\\n", "\n", -1)
|
||||
return s
|
||||
return unescapeTagReplacer.Replace(s)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user