ae9f97221a
* go-metrics: fork library and introduce ResettingTimer and InfluxDB reporter. * vendor: change nonsense/go-metrics to ethersphere/go-metrics * go-metrics: add tests. move ResettingTimer logic from reporter to type. * all, metrics: pull in metrics package in go-ethereum * metrics/test: make sure metrics are enabled for tests * metrics: apply gosimple rules * metrics/exp, internal/debug: init expvar endpoint when starting pprof server * internal/debug: tiny comment formatting fix
22 lines
483 B
Go
22 lines
483 B
Go
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)
|
|
}
|