Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for DecodeLastRune (0.48 sec)

  1. src/unicode/utf8/utf8_test.go

    		}
    		si += size1
    	}
    	j--
    	for si = len(s); si > 0; {
    		r1, size1 := DecodeLastRune(b[0:si])
    		r2, size2 := DecodeLastRuneInString(s[0:si])
    		if size1 != size2 {
    			t.Errorf("DecodeLastRune/DecodeLastRuneInString(%q, %d) size mismatch %d/%d", s, si, size1, size2)
    			return
    		}
    		if r1 != index[j].r {
    			t.Errorf("DecodeLastRune(%q, %d) = %#04x, want %#04x", s, si, r1, index[j].r)
    			return
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 07 06:17:15 UTC 2022
    - 16.2K bytes
    - Viewed (0)
  2. src/unicode/utf8/example_test.go

    // license that can be found in the LICENSE file.
    
    package utf8_test
    
    import (
    	"fmt"
    	"unicode/utf8"
    )
    
    func ExampleDecodeLastRune() {
    	b := []byte("Hello, 世界")
    
    	for len(b) > 0 {
    		r, size := utf8.DecodeLastRune(b)
    		fmt.Printf("%c %v\n", r, size)
    
    		b = b[:len(b)-size]
    	}
    	// Output:
    	// 界 3
    	// 世 3
    	//   1
    	// , 1
    	// o 1
    	// l 1
    	// l 1
    	// e 1
    	// H 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)
  3. src/unicode/utf8/utf8.go

    	}
    	s3 := s[3]
    	if s3 < locb || hicb < s3 {
    		return RuneError, 1
    	}
    	return rune(s0&mask4)<<18 | rune(s1&maskx)<<12 | rune(s2&maskx)<<6 | rune(s3&maskx), 4
    }
    
    // DecodeLastRune unpacks the last UTF-8 encoding in p and returns the rune and
    // its width in bytes. If p is empty it returns ([RuneError], 0). Otherwise, if
    // the encoding is invalid, it returns (RuneError, 1). Both are impossible
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 02:00:36 UTC 2024
    - 16.4K bytes
    - Viewed (0)
  4. src/html/template/css.go

    // case-insensitively matches the lower-case kw.
    func endsWithCSSKeyword(b []byte, kw string) bool {
    	i := len(b) - len(kw)
    	if i < 0 {
    		// Too short.
    		return false
    	}
    	if i != 0 {
    		r, _ := utf8.DecodeLastRune(b[:i])
    		if isCSSNmchar(r) {
    			// Too long.
    			return false
    		}
    	}
    	// Many CSS keywords, such as "!important" can have characters encoded,
    	// but the URI production does not allow that according to
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 02 19:38:18 UTC 2023
    - 7K bytes
    - Viewed (0)
  5. src/html/template/js.go

    	if len(b) == 0 {
    		// In, `x=y/{{.}}*z` a json.Marshaler that produces "" should
    		// not cause the output `x=y/*z`.
    		return " null "
    	}
    	first, _ := utf8.DecodeRune(b)
    	last, _ := utf8.DecodeLastRune(b)
    	var buf strings.Builder
    	// Prevent IdentifierNames and NumericLiterals from running into
    	// keywords: in, instanceof, typeof, void
    	pad := isJSIdentPart(first) || isJSIdentPart(last)
    	if pad {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  6. src/regexp/regexp.go

    	r1, r2 := endOfText, endOfText
    	// 0 < pos && pos <= len(i.str)
    	if uint(pos-1) < uint(len(i.str)) {
    		r1 = rune(i.str[pos-1])
    		if r1 >= utf8.RuneSelf {
    			r1, _ = utf8.DecodeLastRune(i.str[:pos])
    		}
    	}
    	// 0 <= pos && pos < len(i.str)
    	if uint(pos) < uint(len(i.str)) {
    		r2 = rune(i.str[pos])
    		if r2 >= utf8.RuneSelf {
    			r2, _ = utf8.DecodeRune(i.str[pos:])
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 20:50:01 UTC 2024
    - 38.5K bytes
    - Viewed (0)
  7. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"Decode", Func, 0},
    		{"DecodeRune", Func, 0},
    		{"Encode", Func, 0},
    		{"EncodeRune", Func, 0},
    		{"IsSurrogate", Func, 0},
    	},
    	"unicode/utf8": {
    		{"AppendRune", Func, 18},
    		{"DecodeLastRune", Func, 0},
    		{"DecodeLastRuneInString", Func, 0},
    		{"DecodeRune", Func, 0},
    		{"DecodeRuneInString", Func, 0},
    		{"EncodeRune", Func, 0},
    		{"FullRune", Func, 0},
    		{"FullRuneInString", Func, 0},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
  8. api/go1.txt

    pkg unicode/utf8, const MaxRune ideal-char
    pkg unicode/utf8, const RuneError ideal-char
    pkg unicode/utf8, const RuneSelf ideal-int
    pkg unicode/utf8, const UTFMax ideal-int
    pkg unicode/utf8, func DecodeLastRune([]uint8) (int32, int)
    pkg unicode/utf8, func DecodeLastRuneInString(string) (int32, int)
    pkg unicode/utf8, func DecodeRune([]uint8) (int32, int)
    pkg unicode/utf8, func DecodeRuneInString(string) (int32, int)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 14 18:58:28 UTC 2013
    - 1.7M bytes
    - Viewed (0)
Back to top