Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for init (0.12 sec)

  1. src/bufio/example_test.go

    	const input = "1234 5678 1234567901234567890"
    	scanner := bufio.NewScanner(strings.NewReader(input))
    	// Create a custom split function by wrapping the existing ScanWords function.
    	split := func(data []byte, atEOF bool) (advance int, token []byte, err error) {
    		advance, token, err = bufio.ScanWords(data, atEOF)
    		if err == nil && token != nil {
    			_, err = strconv.ParseInt(string(token), 10, 32)
    		}
    		return
    	}
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Oct 23 09:06:30 GMT 2023
    - 4.9K bytes
    - Viewed (0)
  2. src/bytes/example_test.go

    		// a not equal b
    	}
    }
    
    func ExampleCompare_search() {
    	// Binary search to find a matching byte slice.
    	var needle []byte
    	var haystack [][]byte // Assume sorted
    	i := sort.Search(len(haystack), func(i int) bool {
    		// Return haystack[i] >= needle.
    		return bytes.Compare(haystack[i], needle) >= 0
    	})
    	if i < len(haystack) && bytes.Equal(haystack[i], needle) {
    		// Found it!
    	}
    }
    
    func ExampleContains() {
    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