MCPcopy Index your code
hub / github.com/apache/devlake / SanitizeString

Function SanitizeString

backend/core/utils/strings.go:71–84  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

69}
70
71func SanitizeString(s string) string {
72 if s == "" {
73 return s
74 }
75 strLen := len(s)
76 if strLen <= 2 {
77 return strings.Repeat("*", strLen)
78 }
79 prefixLen, suffixLen := 2, 2
80 if strLen <= 5 {
81 prefixLen, suffixLen = 1, 1
82 }
83 return strings.Replace(s, s[prefixLen:strLen-suffixLen], strings.Repeat("*", strLen-prefixLen-suffixLen), -1)
84}
85
86// from https://stackoverflow.com/questions/12311033/extracting-substrings-in-go
87func Substr(input string, start int, length int) string {

Callers 1

TestSanitizeStringFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestSanitizeStringFunction · 0.68