Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for Clone (0.13 sec)

  1. src/bytes/example_test.go

    	}
    	fmt.Println(c)
    	fmt.Println(b.String())
    	// Output:
    	// 97
    	// bcde
    }
    
    func ExampleClone() {
    	b := []byte("abc")
    	clone := bytes.Clone(b)
    	fmt.Printf("%s\n", clone)
    	clone[0] = 'd'
    	fmt.Printf("%s\n", b)
    	fmt.Printf("%s\n", clone)
    	// Output:
    	// abc
    	// abc
    	// dbc
    }
    
    func ExampleCompare() {
    	// Interpret Compare's result by comparing it to zero.
    	var a, b []byte
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
  2. src/bytes/bytes_test.go

    	var cloneTests = [][]byte{
    		[]byte(nil),
    		[]byte{},
    		Clone([]byte{}),
    		[]byte(strings.Repeat("a", 42))[:0],
    		[]byte(strings.Repeat("a", 42))[:0:0],
    		[]byte("short"),
    		[]byte(strings.Repeat("a", 42)),
    	}
    	for _, input := range cloneTests {
    		clone := Clone(input)
    		if !Equal(clone, input) {
    			t.Errorf("Clone(%q) = %q; want %q", input, clone, input)
    		}
    
    		if input == nil && clone != nil {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Jan 24 16:07:25 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  3. src/cmd/api/testdata/src/pkg/p4/golden.txt

    pkg p4, method (Pair[$0, $1]) Second() $1
    pkg p4, method (Pair[$0, $1]) First() $0
    pkg p4, type Pair[$0 interface{ M }, $1 interface{ ~int }] struct
    pkg p4, func Clone[$0 interface{ ~[]$1 }, $1 interface{}]($0) $0
    Plain Text
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Jan 26 19:39:32 GMT 2024
    - 329 bytes
    - Viewed (0)
  4. src/bytes/bytes.go

    	if i := Index(s, sep); i >= 0 {
    		return s[:i], s[i+len(sep):], true
    	}
    	return s, nil, false
    }
    
    // Clone returns a copy of b[:len(b)].
    // The result may have additional unused capacity.
    // Clone(nil) returns nil.
    func Clone(b []byte) []byte {
    	if b == nil {
    		return nil
    	}
    	return append([]byte{}, b...)
    }
    
    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. doc/go1.17_spec.html

    value of type <code>uint</code>.
    If the left operand of a non-constant shift expression is an untyped constant,
    it is first implicitly converted to the type it would assume if the shift expression were
    replaced by its left operand alone.
    </p>
    
    <pre>
    var a [1024]byte
    var s uint = 33
    
    // The results of the following examples are given for 64-bit ints.
    var i = 1&lt;&lt;s                   // 1 has type int
    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)
  6. api/go1.21.txt

    pkg log/slog, method (*Record) AddAttrs(...Attr) #56345
    pkg log/slog, method (*Record) Add(...interface{}) #56345
    pkg log/slog, method (Record) Attrs(func(Attr) bool) #59060
    pkg log/slog, method (Record) Clone() Record #56345
    pkg log/slog, method (Record) NumAttrs() int #56345
    pkg log/slog, method (*TextHandler) Enabled(context.Context, Level) bool #56345
    pkg log/slog, method (*TextHandler) Handle(context.Context, Record) error #56345
    Plain Text
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Mon Aug 07 09:39:17 GMT 2023
    - 25.6K bytes
    - Viewed (0)
  7. src/bufio/bufio.go

    		if e == nil { // got final fragment
    			break
    		}
    		if e != ErrBufferFull { // unexpected error
    			err = e
    			break
    		}
    
    		// Make a copy of the buffer.
    		buf := bytes.Clone(frag)
    		fullBuffers = append(fullBuffers, buf)
    		totalLen += len(buf)
    	}
    
    	totalLen += len(frag)
    	return fullBuffers, frag, totalLen, err
    }
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Thu Oct 12 14:39:08 GMT 2023
    - 21.8K bytes
    - Viewed (0)
  8. doc/go_spec.html

    value of type <code>uint</code>.
    If the left operand of a non-constant shift expression is an untyped constant,
    it is first implicitly converted to the type it would assume if the shift expression were
    replaced by its left operand alone.
    </p>
    
    <pre>
    var a [1024]byte
    var s uint = 33
    
    // The results of the following examples are given for 64-bit ints.
    var i = 1&lt;&lt;s                   // 1 has type int
    HTML
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Thu May 02 22:43:51 GMT 2024
    - 279.6K bytes
    - Viewed (0)
Back to top