MCPcopy Create free account
hub / github.com/cogentcore/core / CleanString

Function CleanString

vgpu/strings.go:49–68  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

47}
48
49func CleanString(s string) string {
50 s = SafeString(s)
51 ss := ""
52 lastSpace := false
53 for _, r := range s {
54 if unicode.IsLetter(r) || unicode.IsNumber(r) {
55 ss += string(r)
56 lastSpace = false
57 } else {
58 if !lastSpace {
59 ss += " "
60 lastSpace = true
61 }
62 }
63 }
64 if lastSpace {
65 return ss[:len(ss)-1]
66 }
67 return ss
68}
69
70func HasAllStrings(s string, strs []string) bool {
71 for _, ss := range strs {

Callers 1

GetDeviceNameMethod · 0.85

Calls 1

SafeStringFunction · 0.85

Tested by

no test coverage detected