Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for CutSuffix (0.2 sec)

  1. src/bytes/example_test.go

    }
    
    func ExampleCutSuffix() {
    	show := func(s, sep string) {
    		before, found := bytes.CutSuffix([]byte(s), []byte(sep))
    		fmt.Printf("CutSuffix(%q, %q) = %q, %v\n", s, sep, before, found)
    	}
    	show("Gopher", "Go")
    	show("Gopher", "er")
    	// Output:
    	// CutSuffix("Gopher", "Go") = "Gopher", false
    	// CutSuffix("Gopher", "er") = "Goph", true
    }
    
    func ExampleEqual() {
    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 s[len(prefix):], true
    }
    
    // CutSuffix returns s without the provided ending suffix byte slice
    // and reports whether it found the suffix.
    // If s doesn't end with suffix, CutSuffix returns s, false.
    // If suffix is the empty byte slice, CutSuffix returns s, true.
    //
    // CutSuffix returns slices of the original slice s, not copies.
    func CutSuffix(s, suffix []byte) (before []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 TestCutSuffix(t *testing.T) {
    	for _, tt := range cutSuffixTests {
    		if before, found := CutSuffix([]byte(tt.s), []byte(tt.sep)); string(before) != tt.before || found != tt.found {
    			t.Errorf("CutSuffix(%q, %q) = %q, %v, want %q, %v", tt.s, tt.sep, before, found, tt.before, tt.found)
    		}
    	}
    }
    
    func TestBufferGrowNegative(t *testing.T) {
    	defer func() {
    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