Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for indexType (0.22 sec)

  1. src/bufio/example_test.go

    // list with an empty final value but stops at the token "STOP".
    func ExampleScanner_earlyStop() {
    	onComma := func(data []byte, atEOF bool) (advance int, token []byte, err error) {
    		i := bytes.IndexByte(data, ',')
    		if i == -1 {
    			if !atEOF {
    				return 0, nil, nil
    			}
    			// If we have reached the end, return the last token.
    			return 0, data, bufio.ErrFinalToken
    		}
    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

    	fmt.Println(bytes.Index([]byte("chicken"), []byte("dmr")))
    	// Output:
    	// 4
    	// -1
    }
    
    func ExampleIndexByte() {
    	fmt.Println(bytes.IndexByte([]byte("chicken"), byte('k')))
    	fmt.Println(bytes.IndexByte([]byte("chicken"), byte('g')))
    	// Output:
    	// 4
    	// -1
    }
    
    func ExampleIndexFunc() {
    	f := func(c rune) bool {
    		return unicode.Is(unicode.Han, c)
    	}
    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