perf: support display binary key name which unreadable(convert to hex string) #49

This commit is contained in:
tiny-craft
2023-10-11 01:15:23 +08:00
parent a6645e3340
commit a4412d21d4
24 changed files with 485 additions and 145 deletions

View File

@@ -0,0 +1,19 @@
package strutil
import "unicode/utf8"
func containsBinary(str string) bool {
//buf := []byte(str)
//size := 0
//for start := 0; start < len(buf); start += size {
// var r rune
// if r, size = utf8.DecodeRune(buf[start:]); r == utf8.RuneError {
// return true
// }
//}
if !utf8.ValidString(str) {
return true
}
return false
}