Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for ContainsFunc (0.09 sec)

  1. src/bytes/example_test.go

    	// true
    	// false
    	// true
    	// true
    	// false
    }
    
    func ExampleContainsFunc() {
    	f := func(r rune) bool {
    		return r >= 'a' && r <= 'z'
    	}
    	fmt.Println(bytes.ContainsFunc([]byte("HELLO"), f))
    	fmt.Println(bytes.ContainsFunc([]byte("World"), f))
    	// Output:
    	// false
    	// true
    }
    
    func ExampleCount() {
    	fmt.Println(bytes.Count([]byte("cheese"), []byte("e")))
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Aug 07 17:22:36 UTC 2024
    - 14.9K bytes
    - Viewed (0)
  2. src/bytes/bytes.go

    // ContainsRune reports whether the rune is contained in the UTF-8-encoded byte slice b.
    func ContainsRune(b []byte, r rune) bool {
    	return IndexRune(b, r) >= 0
    }
    
    // ContainsFunc reports whether any of the UTF-8-encoded code points r within b satisfy f(r).
    func ContainsFunc(b []byte, f func(rune) bool) bool {
    	return IndexFunc(b, f) >= 0
    }
    
    // IndexByte returns the index of the first instance of c in b, or -1 if c is not present in b.
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Sep 03 20:55:15 UTC 2024
    - 35.6K bytes
    - Viewed (0)
  3. src/bytes/bytes_test.go

    				ct.b, ct.r, !ct.expected, ct.expected)
    		}
    	}
    }
    
    func TestContainsFunc(t *testing.T) {
    	for _, ct := range ContainsRuneTests {
    		if ContainsFunc(ct.b, func(r rune) bool {
    			return ct.r == r
    		}) != ct.expected {
    			t.Errorf("ContainsFunc(%q, func(%q)) = %v, want %v",
    				ct.b, ct.r, !ct.expected, ct.expected)
    		}
    	}
    }
    
    var makeFieldsInput = func() []byte {
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Mon Aug 19 19:09:04 UTC 2024
    - 61.2K bytes
    - Viewed (0)
  4. src/cmd/cgo/gcc.go

    		prefix = "C"
    	}
    	n.Mangle = prefix + n.Kind + "_" + n.Go
    }
    
    func (f *File) isMangledName(s string) bool {
    	t, ok := strings.CutPrefix(s, "_C")
    	if !ok {
    		return false
    	}
    	return slices.ContainsFunc(nameKinds, func(k string) bool {
    		return strings.HasPrefix(t, k+"_")
    	})
    }
    
    // rewriteCalls rewrites all calls that pass pointers to check that
    // they follow the rules for passing pointers between Go and C.
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Sep 18 15:07:34 UTC 2024
    - 97.1K bytes
    - Viewed (0)
Back to top