Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 57 for encoderune (0.25 sec)

  1. src/unicode/utf16/utf16.go

    	return replacementChar
    }
    
    // EncodeRune returns the UTF-16 surrogate pair r1, r2 for the given rune.
    // If the rune is not a valid Unicode code point or does not need encoding,
    // EncodeRune returns U+FFFD, U+FFFD.
    func EncodeRune(r rune) (r1, r2 rune) {
    	if r < surrSelf || r > maxRune {
    		return replacementChar, replacementChar
    	}
    	r -= surrSelf
    	return surr1 + (r>>10)&0x3ff, surr2 + r&0x3ff
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 07 19:08:48 UTC 2024
    - 3.9K bytes
    - Viewed (0)
  2. src/unicode/utf16/utf16_test.go

    				if r1 != rune(tt.out[j]) || r2 != rune(tt.out[j+1]) {
    					t.Errorf("EncodeRune(%#x) = %#x, %#x; want %#x, %#x", r, r1, r2, tt.out[j], tt.out[j+1])
    				}
    				j += 2
    				dec := DecodeRune(r1, r2)
    				if dec != r {
    					t.Errorf("DecodeRune(%#x, %#x) = %#x; want %#x", r1, r2, dec, r)
    				}
    			}
    		}
    		if j != len(tt.out) {
    			t.Errorf("#%d: EncodeRune didn't generate enough output", i)
    		}
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 07 19:08:48 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  3. src/html/escape.go

    		// No-op.
    	} else if x := entity[string(entityName)]; x != 0 {
    		return dst + utf8.EncodeRune(b[dst:], x), src + i
    	} else if x := entity2[string(entityName)]; x[0] != 0 {
    		dst1 := dst + utf8.EncodeRune(b[dst:], x[0])
    		return dst1 + utf8.EncodeRune(b[dst1:], x[1]), src + i
    	} else if !attribute {
    		maxLen := len(entityName) - 1
    		if maxLen > longestEntityWithoutSemicolon {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 13 07:00:18 UTC 2020
    - 5K bytes
    - Viewed (0)
  4. src/unicode/utf8/example_test.go

    	}
    	// Output:
    	// H 1
    	// e 1
    	// l 1
    	// l 1
    	// o 1
    	// , 1
    	//   1
    	// 世 3
    	// 界 3
    }
    
    func ExampleEncodeRune() {
    	r := '世'
    	buf := make([]byte, 3)
    
    	n := utf8.EncodeRune(buf, r)
    
    	fmt.Println(buf)
    	fmt.Println(n)
    	// Output:
    	// [228 184 150]
    	// 3
    }
    
    func ExampleEncodeRune_outOfRange() {
    	runes := []rune{
    		// Less than 0, out of range.
    		-1,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 05 21:29:18 UTC 2021
    - 3.6K bytes
    - Viewed (0)
  5. src/vendor/golang.org/x/text/unicode/norm/composition.go

    	const JamoUTF8Len = 3
    	r -= hangulBase
    	x := r % jamoTCount
    	r /= jamoTCount
    	utf8.EncodeRune(buf, jamoLBase+r/jamoVCount)
    	utf8.EncodeRune(buf[JamoUTF8Len:], jamoVBase+r%jamoVCount)
    	if x != 0 {
    		utf8.EncodeRune(buf[2*JamoUTF8Len:], jamoTBase+x)
    		return 3 * JamoUTF8Len
    	}
    	return 2 * JamoUTF8Len
    }
    
    // decomposeHangul algorithmically decomposes a Hangul rune into
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 19:27:51 UTC 2019
    - 14.1K bytes
    - Viewed (0)
  6. src/cmd/vendor/golang.org/x/text/unicode/norm/composition.go

    	const JamoUTF8Len = 3
    	r -= hangulBase
    	x := r % jamoTCount
    	r /= jamoTCount
    	utf8.EncodeRune(buf, jamoLBase+r/jamoVCount)
    	utf8.EncodeRune(buf[JamoUTF8Len:], jamoVBase+r%jamoVCount)
    	if x != 0 {
    		utf8.EncodeRune(buf[2*JamoUTF8Len:], jamoTBase+x)
    		return 3 * JamoUTF8Len
    	}
    	return 2 * JamoUTF8Len
    }
    
    // decomposeHangul algorithmically decomposes a Hangul rune into
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 24 13:01:26 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  7. src/runtime/utf8.go

    		n++
    	}
    	return n
    }
    
    // decoderune returns the non-ASCII rune at the start of
    // s[k:] and the index after the rune in s.
    //
    // decoderune assumes that caller has checked that
    // the to be decoded rune is a non-ASCII rune.
    //
    // If the string appears to be incomplete or decoding problems
    // are encountered (runeerror, k + 1) is returned to ensure
    // progress when decoderune is used to iterate over a string.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 06 02:46:02 UTC 2020
    - 3.4K bytes
    - Viewed (0)
  8. src/unicode/utf8/utf8_test.go

    		b := []byte(m.str)
    		r, size := DecodeRune(b)
    		if r != RuneError || size != 1 {
    			t.Errorf("DecodeRune(%q) = %x, %d want %x, %d", b, r, size, RuneError, 1)
    		}
    		s := m.str
    		r, size = DecodeRuneInString(s)
    		if r != RuneError || size != 1 {
    			t.Errorf("DecodeRuneInString(%q) = %x, %d want %x, %d", b, r, size, RuneError, 1)
    		}
    	}
    }
    
    // Check that DecodeRune and DecodeLastRune correspond to
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 07 06:17:15 UTC 2022
    - 16.2K bytes
    - Viewed (0)
  9. src/runtime/string.go

    	}
    	var dum [4]byte
    	size1 := 0
    	for _, r := range a {
    		size1 += encoderune(dum[:], r)
    	}
    	s, b := rawstringtmp(buf, size1+3)
    	size2 := 0
    	for _, r := range a {
    		// check for race
    		if size2 >= size1 {
    			break
    		}
    		size2 += encoderune(b[size2:], r)
    	}
    	return s[:size2]
    }
    
    type stringStruct struct {
    	str unsafe.Pointer
    	len int
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:17:26 UTC 2024
    - 13.4K bytes
    - Viewed (0)
  10. src/html/template/css.go

    			if r > unicode.MaxRune {
    				r, j = r/16, j-1
    			}
    			n := utf8.EncodeRune(b[len(b):cap(b)], r)
    			// The optional space at the end allows a hex
    			// sequence to be followed by a literal hex.
    			// string(decodeCSS([]byte(`\A B`))) == "\nB"
    			b, s = b[:len(b)+n], skipCSSSpace(s[j:])
    		} else {
    			// `\\` decodes to `\` and `\"` to `"`.
    			_, n := utf8.DecodeRune(s[1:])
    			b, s = append(b, s[1:1+n]...), s[1+n:]
    		}
    	}
    	return b
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 02 19:38:18 UTC 2023
    - 7K bytes
    - Viewed (0)
Back to top