PrintableBytes returns true iff the given byte array is a valid UTF-8 sequence and it is printable.
(b []byte)
| 2408 | // PrintableBytes returns true iff the given byte array is a valid |
| 2409 | // UTF-8 sequence and it is printable. |
| 2410 | func PrintableBytes(b []byte) bool { |
| 2411 | return len(bytes.TrimLeftFunc(b, isValidAndPrintableRune)) == 0 |
| 2412 | } |
| 2413 | |
| 2414 | func isValidAndPrintableRune(r rune) bool { |
| 2415 | return r != utf8.RuneError && unicode.IsPrint(r) |
no outgoing calls
no test coverage detected
searching dependent graphs…