LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
| 4 |
| 5 //go:generate go run makeisprint.go -output isprint.go |
4 | 6 |
5 package strconv | 7 package strconv |
6 | 8 |
7 import ( | 9 import ( |
8 "unicode/utf8" | 10 "unicode/utf8" |
9 ) | 11 ) |
10 | 12 |
11 const lowerhex = "0123456789abcdef" | 13 const lowerhex = "0123456789abcdef" |
12 | 14 |
13 func quoteWith(s string, quote byte, ASCIIonly bool) string { | 15 func quoteWith(s string, quote byte, ASCIIonly bool) string { |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 if i >= len(isPrint) || rr < isPrint[i&^1] || isPrint[i|1] < rr { | 446 if i >= len(isPrint) || rr < isPrint[i&^1] || isPrint[i|1] < rr { |
445 return false | 447 return false |
446 } | 448 } |
447 if r >= 0x20000 { | 449 if r >= 0x20000 { |
448 return true | 450 return true |
449 } | 451 } |
450 r -= 0x10000 | 452 r -= 0x10000 |
451 j := bsearch16(isNotPrint, uint16(r)) | 453 j := bsearch16(isNotPrint, uint16(r)) |
452 return j >= len(isNotPrint) || isNotPrint[j] != uint16(r) | 454 return j >= len(isNotPrint) || isNotPrint[j] != uint16(r) |
453 } | 455 } |
LEFT | RIGHT |