| 1 |
package ascii |
| 2 |
|
| 3 |
import "github.com/segmentio/asm/internal/unsafebytes" |
| 4 |
|
| 5 |
// ValidPrint returns true if b contains only printable ASCII characters. |
| 6 |
func ValidPrint(b []byte) bool { |
| 7 |
return ValidPrintString(unsafebytes.String(b)) |
| 8 |
} |
| 9 |
|
| 10 |
// ValidPrintBytes returns true if b is an ASCII character. |
| 11 |
func ValidPrintByte(b byte) bool { |
| 12 |
return 0x20 <= b && b <= 0x7e |
| 13 |
} |
| 14 |
|
| 15 |
// ValidPrintBytes returns true if b is an ASCII character. |
| 16 |
func ValidPrintRune(r rune) bool { |
| 17 |
return 0x20 <= r && r <= 0x7e |
| 18 |
} |