Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for CutPrefix (0.07 sec)

  1. src/bytes/example_test.go

    }
    
    func ExampleCutPrefix() {
    	show := func(s, sep string) {
    		after, found := bytes.CutPrefix([]byte(s), []byte(sep))
    		fmt.Printf("CutPrefix(%q, %q) = %q, %v\n", s, sep, after, found)
    	}
    	show("Gopher", "Go")
    	show("Gopher", "ph")
    	// Output:
    	// CutPrefix("Gopher", "Go") = "pher", true
    	// CutPrefix("Gopher", "ph") = "Gopher", false
    }
    
    func ExampleCutSuffix() {
    	show := func(s, sep string) {
    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

    	}
    	return append([]byte{}, b...)
    }
    
    // CutPrefix returns s without the provided leading prefix byte slice
    // and reports whether it found the prefix.
    // If s doesn't start with prefix, CutPrefix returns s, false.
    // If prefix is the empty byte slice, CutPrefix returns s, true.
    //
    // CutPrefix returns slices of the original slice s, not copies.
    func CutPrefix(s, prefix []byte) (after []byte, found bool) {
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Sep 03 20:55:15 UTC 2024
    - 35.6K bytes
    - Viewed (0)
Back to top