mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-28 02:01:19 +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))
|
|
}
|