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

Function sanitize

ext/strings.go:879–889  ·  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

877
878// sanitize replaces all invalid runes in the given string with utf8.RuneError.
879func sanitize(s string) string {
880 var sanitizedStringBuilder strings.Builder
881 for _, r := range s {
882 if !utf8.ValidRune(r) {
883 sanitizedStringBuilder.WriteRune(utf8.RuneError)
884 } else {
885 sanitizedStringBuilder.WriteRune(r)
886 }
887 }
888 return sanitizedStringBuilder.String()
889}
890
891var (
892 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