Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for ExampleIndexFunc (0.29 sec)

  1. src/cmd/internal/test2json/testdata/framebig.json

    {"Action":"pass","Test":"ExampleIndex"}
    {"Action":"run","Test":"ExampleIndexFunc"}
    {"Action":"output","Test":"ExampleIndexFunc","Output":"=== RUN   ExampleIndexFunc\n"}
    {"Action":"output","Test":"ExampleIndexFunc","Output":"--- PASS: ExampleIndexFunc (0.00s)\n"}
    {"Action":"pass","Test":"ExampleIndexFunc"}
    {"Action":"run","Test":"ExampleIndexAny"}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 09 17:33:07 UTC 2022
    - 12.2K bytes
    - Viewed (0)
  2. src/slices/example_test.go

    	// true
    }
    
    func ExampleIndex() {
    	numbers := []int{0, 42, 8}
    	fmt.Println(slices.Index(numbers, 8))
    	fmt.Println(slices.Index(numbers, 7))
    	// Output:
    	// 2
    	// -1
    }
    
    func ExampleIndexFunc() {
    	numbers := []int{0, 42, -10, 8}
    	i := slices.IndexFunc(numbers, func(n int) bool {
    		return n < 0
    	})
    	fmt.Println("First negative at index", i)
    	// Output:
    	// First negative at index 2
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 10 17:28:50 UTC 2024
    - 8.1K bytes
    - Viewed (0)
  3. src/strings/example_test.go

    	// false
    	// true
    }
    
    func ExampleIndex() {
    	fmt.Println(strings.Index("chicken", "ken"))
    	fmt.Println(strings.Index("chicken", "dmr"))
    	// Output:
    	// 4
    	// -1
    }
    
    func ExampleIndexFunc() {
    	f := func(c rune) bool {
    		return unicode.Is(unicode.Han, c)
    	}
    	fmt.Println(strings.IndexFunc("Hello, 世界", f))
    	fmt.Println(strings.IndexFunc("Hello, world", f))
    	// Output:
    	// 7
    	// -1
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 09 22:05:38 UTC 2023
    - 10.7K bytes
    - Viewed (0)
Back to top