Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for Len (0.16 sec)

  1. src/bytes/buffer_test.go

    	bytes := buf.Bytes()
    	str := buf.String()
    	if buf.Len() != len(bytes) {
    		t.Errorf("%s: buf.Len() == %d, len(buf.Bytes()) == %d", testname, buf.Len(), len(bytes))
    	}
    
    	if buf.Len() != len(str) {
    		t.Errorf("%s: buf.Len() == %d, len(buf.String()) == %d", testname, buf.Len(), len(str))
    	}
    
    	if buf.Len() != len(s) {
    		t.Errorf("%s: buf.Len() == %d, len(s) == %d", testname, buf.Len(), len(s))
    	}
    
    	if string(bytes) != s {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Apr 26 13:31:36 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  2. src/archive/zip/reader_test.go

    	}
    	r.Close()
    
    	if g := uint64(b.Len()); g != size {
    		t.Errorf("%v: read %v bytes but f.UncompressedSize == %v", f.Name, g, size)
    	}
    
    	var c []byte
    	if ft.Content != nil {
    		c = ft.Content
    	} else if c, err = os.ReadFile("testdata/" + ft.File); err != nil {
    		t.Error(err)
    		return
    	}
    
    	if b.Len() != len(c) {
    		t.Errorf("%s: len=%d, want %d", f.Name, b.Len(), len(c))
    		return
    	}
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Mar 27 18:23:49 GMT 2024
    - 55.3K bytes
    - Viewed (0)
  3. doc/go1.17_spec.html

    and whose length and capacity are <code>len</code>.
    <code>Slice(ptr, len)</code> is equivalent to
    </p>
    
    <pre>
    (*[len]ArbitraryType)(unsafe.Pointer(ptr))[:]
    </pre>
    
    <p>
    except that, as a special case, if <code>ptr</code>
    is <code>nil</code> and <code>len</code> is zero,
    <code>Slice</code> returns <code>nil</code>.
    </p>
    
    <p>
    HTML
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Thu Apr 11 20:22:45 GMT 2024
    - 211.6K bytes
    - Viewed (0)
  4. src/bytes/bytes.go

    func Join(s [][]byte, sep []byte) []byte {
    	if len(s) == 0 {
    		return []byte{}
    	}
    	if len(s) == 1 {
    		// Just return a copy.
    		return append([]byte(nil), s[0]...)
    	}
    
    	var n int
    	if len(sep) > 0 {
    		if len(sep) >= maxInt/(len(s)-1) {
    			panic("bytes: Join output length overflow")
    		}
    		n += len(sep) * (len(s) - 1)
    	}
    	for _, v := range s {
    		if len(v) > maxInt-n {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Feb 19 19:51:15 GMT 2024
    - 33.8K bytes
    - Viewed (0)
  5. src/archive/zip/zip_test.go

    				rp.n += int64(len(p))
    				return len(p), nil
    			}
    		}
    	}
    
    	for _, b := range p {
    		if rp == nil || rp.b != b {
    			r.buf = append(r.buf, repeatedByte{r.Size(), b, 1})
    			rp = &r.buf[len(r.buf)-1]
    		} else {
    			rp.n++
    		}
    	}
    	return len(p), nil
    }
    
    func memset(a []byte, b byte) {
    	if len(a) == 0 {
    		return
    	}
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Mar 27 18:23:49 GMT 2024
    - 19.5K bytes
    - Viewed (0)
  6. lib/time/mkzip.go

    		}
    		name := filepath.ToSlash(path)
    		w, err := zw.CreateRaw(&zip.FileHeader{
    			Name:               name,
    			Method:             zip.Store,
    			CompressedSize64:   uint64(len(data)),
    			UncompressedSize64: uint64(len(data)),
    			CRC32:              crc32.ChecksumIEEE(data),
    		})
    		if err != nil {
    			log.Fatal(err)
    		}
    		if _, err := w.Write(data); err != nil {
    			log.Fatal(err)
    		}
    		seen[name] = true
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Mar 04 17:32:07 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  7. src/cmd/addr2line/addr2line_test.go

    	}
    	f := strings.Split(string(out), "\n")
    	if len(f) < 3 && f[2] == "" {
    		t.Fatal("addr2line output must have 2 lines")
    	}
    	funcname = f[0]
    	pathAndLineNo := f[1]
    	f = strings.Split(pathAndLineNo, ":")
    	if runtime.GOOS == "windows" && len(f) == 3 {
    		// Reattach drive letter.
    		f = []string{f[0] + ":" + f[1], f[2]}
    	}
    	if len(f) != 2 {
    		t.Fatalf("no line number found in %q", pathAndLineNo)
    	}
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Feb 21 22:16:54 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  8. src/archive/tar/common.go

    	ustar := blk.toUSTAR()
    	gnu := blk.toGNU()
    	verifyString(h.Name, len(v7.name()), "Name", paxPath)
    	verifyString(h.Linkname, len(v7.linkName()), "Linkname", paxLinkpath)
    	verifyString(h.Uname, len(ustar.userName()), "Uname", paxUname)
    	verifyString(h.Gname, len(ustar.groupName()), "Gname", paxGname)
    	verifyNumeric(h.Mode, len(v7.mode()), "Mode", paxNone)
    	verifyNumeric(int64(h.Uid), len(v7.uid()), "Uid", paxUid)
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Mar 15 16:01:50 GMT 2024
    - 24.7K bytes
    - Viewed (2)
  9. doc/next/6-stdlib/99-minor/reflect/61308.md

    The [SliceAt(typ Type, p unsafe.Pointer, len int)] function
    returns a Value representing a slice whose underlying array starts
    Plain Text
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Fri Apr 12 20:57:18 GMT 2024
    - 170 bytes
    - Viewed (0)
  10. src/bytes/example_test.go

    func ExampleBuffer_Grow() {
    	var b bytes.Buffer
    	b.Grow(64)
    	bb := b.Bytes()
    	b.Write([]byte("64 bytes or fewer"))
    	fmt.Printf("%q", bb[:b.Len()])
    	// Output: "64 bytes or fewer"
    }
    
    func ExampleBuffer_Len() {
    	var b bytes.Buffer
    	b.Grow(64)
    	b.Write([]byte("abcde"))
    	fmt.Printf("%d", b.Len())
    	// Output: 5
    }
    
    func ExampleBuffer_Next() {
    	var b bytes.Buffer
    	b.Grow(64)
    	b.Write([]byte("abcde"))
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
Back to top