Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExampleCompare_search (0.13 sec)

  1. src/bytes/example_test.go

    	}
    
    	// Prefer Equal to Compare for equality comparisons.
    	if bytes.Equal(a, b) {
    		// a equal b
    	}
    	if !bytes.Equal(a, b) {
    		// a not equal b
    	}
    }
    
    func ExampleCompare_search() {
    	// Binary search to find a matching byte slice.
    	var needle []byte
    	var haystack [][]byte // Assume sorted
    	_, found := slices.BinarySearchFunc(haystack, needle, bytes.Compare)
    	if found {
    		// Found it!
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Aug 07 17:22:36 UTC 2024
    - 14.9K bytes
    - Viewed (0)
Back to top