mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-26 09:17:55 +00:00
17 lines
293 B
Go
17 lines
293 B
Go
|
package script
|
||
|
|
||
|
import (
|
||
|
"html"
|
||
|
"regexp"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func EscapeString(s string) string {
|
||
|
re := regexp.MustCompile(`\r?\n`)
|
||
|
return re.ReplaceAllString(html.EscapeString(s), `\n`)
|
||
|
}
|
||
|
|
||
|
func UnescapeString(s string) string {
|
||
|
return html.UnescapeString(strings.Replace(s, `\n`, "\n", -1))
|
||
|
}
|