MCPcopy Create free account
hub / github.com/cel-expr/cel-go / sanitize

Function sanitize

ext/strings.go:853–863  ·  view source on GitHub ↗

sanitize replaces all invalid runes in the given string with utf8.RuneError.

(s string)

Source from the content-addressed store, hash-verified

851
852// sanitize replaces all invalid runes in the given string with utf8.RuneError.
853func sanitize(s string) string {
854 var sanitizedStringBuilder strings.Builder
855 for _, r := range s {
856 if !utf8.ValidRune(r) {
857 sanitizedStringBuilder.WriteRune(utf8.RuneError)
858 } else {
859 sanitizedStringBuilder.WriteRune(r)
860 }
861 }
862 return sanitizedStringBuilder.String()
863}
864
865var (
866 stringListType = reflect.TypeFor[[]string]()

Callers 3

quoteFunction · 0.85
unquoteFunction · 0.85
FuzzQuoteFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by 2

unquoteFunction · 0.68
FuzzQuoteFunction · 0.68