- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for EncodeRune (0.1 sec)
-
src/bufio/bufio_test.go
const NRune = 1000 byteBuf := new(bytes.Buffer) w := NewWriter(byteBuf) // Write the runes out using WriteRune buf := make([]byte, utf8.UTFMax) for r := rune(0); r < NRune; r++ { size := utf8.EncodeRune(buf, r) nbytes, err := w.WriteRune(r) if err != nil { t.Fatalf("WriteRune(0x%x) error: %s", r, err) } if nbytes != size { t.Fatalf("WriteRune(0x%x) expected %d, got %d", r, size, nbytes) }
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Fri Nov 01 21:52:12 UTC 2024 - 51.6K bytes - Viewed (0) -
src/bytes/bytes_test.go
} } buf[n-1] = '\x00' } } func bmIndexRune(index func([]byte, rune) int) func(b *testing.B, n int) { return func(b *testing.B, n int) { buf := bmbuf[0:n] utf8.EncodeRune(buf[n-3:], '世') for i := 0; i < b.N; i++ { j := index(buf, '世') if j != n-3 { b.Fatal("bad index", j) } } buf[n-3] = '\x00' buf[n-2] = '\x00' buf[n-1] = '\x00' } }
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Mon Aug 19 19:09:04 UTC 2024 - 61.2K bytes - Viewed (0)