2023-10-11 01:15:23 +08:00
|
|
|
package strutil
|
|
|
|
|
2023-10-30 21:54:20 +08:00
|
|
|
import (
|
|
|
|
"unicode"
|
|
|
|
)
|
2023-10-11 01:15:23 +08:00
|
|
|
|
|
|
|
func containsBinary(str string) bool {
|
|
|
|
//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
|
|
|
|
// }
|
|
|
|
//}
|
2023-10-30 21:54:20 +08:00
|
|
|
rs := []rune(str)
|
|
|
|
for _, r := range rs {
|
2023-11-05 11:57:52 +08:00
|
|
|
if !unicode.IsPrint(r) && r != '\n' {
|
2023-10-30 21:54:20 +08:00
|
|
|
return true
|
|
|
|
}
|
2023-10-11 01:15:23 +08:00
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|