MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / filterSpecialCharacters4LabelValue

Function filterSpecialCharacters4LabelValue

cli/pkg/k8s/helper.go:72–84  ·  view source on GitHub ↗
(content string)

Source from the content-addressed store, hash-verified

70}
71
72func filterSpecialCharacters4LabelValue(content string) string {
73 if len(content) >= 63 {
74 content = content[:62]
75 }
76
77 reg, _ := regexp.Compile(`[^-A-Za-z0-9_.]`)
78 relValue := reg.ReplaceAllString(content, "-")
79
80 regFirstAnEnd, _ := regexp.Compile(`^[^A-Za-z0-9]|[^A-Za-z0-9]$`)
81 relValue = regFirstAnEnd.ReplaceAllString(relValue, "0")
82
83 return relValue
84}

Callers 1

AddLabelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected