Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for CutPrefix (0.26 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) {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
  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) {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Feb 19 19:51:15 GMT 2024
    - 33.8K bytes
    - Viewed (0)
  3. src/bytes/bytes_test.go

    	{"", "d", "", false},
    	{"", "", "", true},
    }
    
    func TestCutPrefix(t *testing.T) {
    	for _, tt := range cutPrefixTests {
    		if after, found := CutPrefix([]byte(tt.s), []byte(tt.sep)); string(after) != tt.after || found != tt.found {
    			t.Errorf("CutPrefix(%q, %q) = %q, %v, want %q, %v", tt.s, tt.sep, after, found, tt.after, tt.found)
    		}
    	}
    }
    
    var cutSuffixTests = []struct {
    	s, sep string
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Jan 24 16:07:25 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  4. api/go1.20.txt

    pkg archive/tar, var ErrInsecurePath error #55356
    pkg archive/zip, var ErrInsecurePath error #55356
    pkg bytes, func Clone([]uint8) []uint8 #45038
    pkg bytes, func CutPrefix([]uint8, []uint8) ([]uint8, bool) #42537
    pkg bytes, func CutSuffix([]uint8, []uint8) ([]uint8, bool) #42537
    pkg context, func Cause(Context) error #51365
    pkg context, func WithCancelCause(Context) (Context, CancelCauseFunc) #51365
    pkg context, type CancelCauseFunc func(error) #51365
    Plain Text
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Feb 17 21:23:32 GMT 2023
    - 602.6K bytes
    - Viewed (0)
Back to top