mirror of
https://github.com/tiny-craft/tiny-rdm.git
synced 2025-10-05 15:16:54 +08:00
perf: support display binary key name which unreadable(convert to hex string) #49
This commit is contained in:
19
backend/utils/string/common.go
Normal file
19
backend/utils/string/common.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user