Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExampleIsSortedFunc (0.21 sec)

  1. src/slices/example_test.go

    }
    
    func ExampleIsSorted() {
    	fmt.Println(slices.IsSorted([]string{"Alice", "Bob", "Vera"}))
    	fmt.Println(slices.IsSorted([]int{0, 2, 1}))
    	// Output:
    	// true
    	// false
    }
    
    func ExampleIsSortedFunc() {
    	names := []string{"alice", "Bob", "VERA"}
    	isSortedInsensitive := slices.IsSortedFunc(names, func(a, b string) int {
    		return strings.Compare(strings.ToLower(a), strings.ToLower(b))
    	})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 10 17:28:50 UTC 2024
    - 8.1K bytes
    - Viewed (0)
Back to top