1
0
Fork 0
mirror of https://github.com/Luzifer/continuous-spark.git synced 2024-12-21 10:11:16 +00:00
continuous-spark/vendor/github.com/influxdata/influxdb/pkg/escape/strings.go

22 lines
483 B
Go
Raw Normal View History

package escape
import "strings"
var (
escaper = strings.NewReplacer(`,`, `\,`, `"`, `\"`, ` `, `\ `, `=`, `\=`)
unescaper = strings.NewReplacer(`\,`, `,`, `\"`, `"`, `\ `, ` `, `\=`, `=`)
)
// UnescapeString returns unescaped version of in.
func UnescapeString(in string) string {
if strings.IndexByte(in, '\\') == -1 {
return in
}
return unescaper.Replace(in)
}
// String returns the escaped version of in.
func String(in string) string {
return escaper.Replace(in)
}