MCPcopy
hub / github.com/gofiber/fiber / RemoveEscapeChar

Function RemoveEscapeChar

path.go:646–663  ·  view source on GitHub ↗

RemoveEscapeChar removes escape characters

(word string)

Source from the content-addressed store, hash-verified

644
645// RemoveEscapeChar removes escape characters
646func RemoveEscapeChar(word string) string {
647 // Fast path: check if there are any escape characters first
648 escapeIdx := strings.IndexByte(word, '\\')
649 if escapeIdx == -1 {
650 return word // No escape chars, return original string without allocation
651 }
652
653 // Slow path: copy and remove escape characters
654 b := []byte(word)
655 dst := escapeIdx
656 for src := escapeIdx + 1; src < len(b); src++ {
657 if b[src] != '\\' {
658 b[dst] = b[src]
659 dst++
660 }
661 }
662 return string(b[:dst])
663}
664
665// RemoveEscapeCharBytes removes escape characters
666func RemoveEscapeCharBytes(word []byte) []byte {

Callers 9

addPrefixToRouteMethod · 0.85
normalizePathMethod · 0.85
registerMethod · 0.85
addParameterMetaInfoFunction · 0.85
analyseConstantPartMethod · 0.85
analyseParameterPartMethod · 0.85
parseConstraintArgsFunction · 0.85

Calls

no outgoing calls

Tested by 2