- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for ScanBytes (0.51 sec)
-
src/bufio/scan.go
func (s *Scanner) Split(split SplitFunc) { if s.scanCalled { panic("Split called after Scan") } s.split = split } // Split functions // ScanBytes is a split function for a [Scanner] that returns each byte as a token. func ScanBytes(data []byte, atEOF bool) (advance int, token []byte, err error) { if atEOF && len(data) == 0 { return 0, nil, nil } return 1, data[0:1], nil }
Registered: Tue Sep 09 11:13:09 UTC 2025 - Last Modified: Wed May 21 18:05:26 UTC 2025 - 14.2K bytes - Viewed (0) -
src/bufio/scan_test.go
"abcdefgh", "abc def\n\t\tgh ", "abc¼☹\x81\uFFFD日本語\x82abc", } func TestScanByte(t *testing.T) { for n, test := range scanTests { buf := strings.NewReader(test) s := NewScanner(buf) s.Split(ScanBytes) var i int for i = 0; s.Scan(); i++ { if b := s.Bytes(); len(b) != 1 || b[0] != test[i] { t.Errorf("#%d: %d: expected %q got %q", n, i, test, b) } } if i != len(test) {
Registered: Tue Sep 09 11:13:09 UTC 2025 - Last Modified: Fri Sep 22 16:22:42 UTC 2023 - 14.3K bytes - Viewed (0)