mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-25 17:05:21 +00:00
16 lines
293 B
Go
16 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))
|
|
}
|