MCPcopy Create free account
hub / github.com/canopyclimate/golive / EscapeString

Function EscapeString

internal/json/string.go:16–19  ·  view source on GitHub ↗

EscapeString escapes JSON string contents. It does not add quotes around it. It returns ErrInvalidUTF8 if s contains invalid UTF-8. That is the only possible error.

(s string)

Source from the content-addressed store, hash-verified

14// It returns ErrInvalidUTF8 if s contains invalid UTF-8.
15// That is the only possible error.
16func EscapeString(s string) (string, error) {
17 b, err := AppendString(nil, s)
18 return string(b), err
19}
20
21// The following code is extracted from https://github.com/go-json-experiment/json
22// at commit 3fecd76f5acdb9037c6c96eb6b869c69293f9c21 (Nov 7, 2022).

Callers

nothing calls this directly

Calls 1

AppendStringFunction · 0.85

Tested by

no test coverage detected