Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 57 for encoderune (0.18 sec)

  1. src/unicode/utf8/utf8.go

    	case r <= rune3Max:
    		return 3
    	case r <= MaxRune:
    		return 4
    	}
    	return -1
    }
    
    // EncodeRune writes into p (which must be large enough) the UTF-8 encoding of the rune.
    // If the rune is out of range, it writes the encoding of [RuneError].
    // It returns the number of bytes written.
    func EncodeRune(p []byte, r rune) int {
    	// Negative values are erroneous. Making it unsigned addresses the problem.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 02:00:36 UTC 2024
    - 16.4K bytes
    - Viewed (0)
  2. src/vendor/golang.org/x/text/unicode/bidi/prop.go

    	0x8: FSI, // U+2068 FirstStrongIsolate,
    	0x9: PDI, // U+2069 PopDirectionalIsolate,
    }
    
    // LookupRune returns properties for r.
    func LookupRune(r rune) (p Properties, size int) {
    	var buf [4]byte
    	n := utf8.EncodeRune(buf[:], r)
    	return Lookup(buf[:n])
    }
    
    // TODO: these lookup methods are based on the generated trie code. The returned
    // sizes have slightly different semantics from the generated code, in that it
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 11 20:28:54 UTC 2019
    - 5.7K bytes
    - Viewed (0)
  3. src/encoding/json/decode.go

    					rr1 := getu4(s[r:])
    					if dec := utf16.DecodeRune(rr, rr1); dec != unicode.ReplacementChar {
    						// A valid pair; consume.
    						r += 6
    						w += utf8.EncodeRune(b[w:], dec)
    						break
    					}
    					// Invalid surrogate; fall back to replacement rune.
    					rr = unicode.ReplacementChar
    				}
    				w += utf8.EncodeRune(b[w:], rr)
    			}
    
    		// Quote, control characters are invalid.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:18:55 UTC 2024
    - 35.3K bytes
    - Viewed (0)
  4. src/bytes/buffer_test.go

    func TestRuneIO(t *testing.T) {
    	const NRune = 1000
    	// Built a test slice while we write the data
    	b := make([]byte, utf8.UTFMax*NRune)
    	var buf Buffer
    	n := 0
    	for r := rune(0); r < NRune; r++ {
    		size := utf8.EncodeRune(b[n:], r)
    		nbytes, err := buf.WriteRune(r)
    		if err != nil {
    			t.Fatalf("WriteRune(%U) error: %s", r, err)
    		}
    		if nbytes != size {
    			t.Fatalf("WriteRune(%U) expected %d, got %d", r, size, nbytes)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 13:31:36 UTC 2024
    - 18.6K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/types2/typestring.go

    func subscript(x uint64) string {
    	const w = len("₀") // all digits 0...9 have the same utf8 width
    	var buf [32 * w]byte
    	i := len(buf)
    	for {
    		i -= w
    		utf8.EncodeRune(buf[i:], '₀'+rune(x%10)) // '₀' == U+2080
    		x /= 10
    		if x == 0 {
    			break
    		}
    	}
    	return string(buf[i:])
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  6. src/go/types/typestring.go

    func subscript(x uint64) string {
    	const w = len("₀") // all digits 0...9 have the same utf8 width
    	var buf [32 * w]byte
    	i := len(buf)
    	for {
    		i -= w
    		utf8.EncodeRune(buf[i:], '₀'+rune(x%10)) // '₀' == U+2080
    		x /= 10
    		if x == 0 {
    			break
    		}
    	}
    	return string(buf[i:])
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 12.3K bytes
    - Viewed (0)
  7. src/fmt/format.go

    	// For %#U we want to add a space and a quoted character at the end of the buffer.
    	if f.sharp && u <= utf8.MaxRune && strconv.IsPrint(rune(u)) {
    		i--
    		buf[i] = '\''
    		i -= utf8.RuneLen(rune(u))
    		utf8.EncodeRune(buf[i:], rune(u))
    		i--
    		buf[i] = '\''
    		i--
    		buf[i] = ' '
    	}
    	// Format the Unicode code point u as a hexadecimal number.
    	for u >= 16 {
    		i--
    		buf[i] = udigits[u&0xF]
    		prec--
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:31:55 UTC 2024
    - 13.8K bytes
    - Viewed (0)
  8. src/bufio/bufio.go

    		if b.Flush(); b.err != nil {
    			return 0, b.err
    		}
    		n = b.Available()
    		if n < utf8.UTFMax {
    			// Can only happen if buffer is silly small.
    			return b.WriteString(string(r))
    		}
    	}
    	size = utf8.EncodeRune(b.buf[b.n:], r)
    	b.n += size
    	return size, nil
    }
    
    // WriteString writes a string.
    // It returns the number of bytes written.
    // If the count is less than len(s), it also returns an error explaining
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 12 14:39:08 UTC 2023
    - 21.8K bytes
    - Viewed (0)
  9. 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: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 10 18:56:01 UTC 2023
    - 51.5K bytes
    - Viewed (0)
  10. 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: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 12:58:37 UTC 2024
    - 56.5K bytes
    - Viewed (0)
Back to top