Changed ScriptEscape from []byte to string
This commit is contained in:
parent
8dc7cdb1cd
commit
be268f2f76
@ -5,11 +5,11 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ScriptEscape(source []byte) (escaped []byte) {
|
func ScriptEscape(source string) (escaped string) {
|
||||||
rxp2 := regexp.MustCompile("([\"\\\\$])")
|
rxp2 := regexp.MustCompile("([\"\\\\$])")
|
||||||
source = rxp2.ReplaceAll(source, []byte("\\$1"))
|
source = rxp2.ReplaceAllString(source, "\\$1")
|
||||||
|
|
||||||
rxp := regexp.MustCompile("\\r?\\n")
|
rxp := regexp.MustCompile("\\r?\\n")
|
||||||
escaped = rxp.ReplaceAll(source, []byte("\\r\\\r\n \\n"))
|
escaped = rxp.ReplaceAllString(source, "\\r\\\r\n \\n")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user