Search Options

Results per page
Sort
Preferred Languages
Advance

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

  1. src/cmd/cgo/gcc.go

    func cname(s string) string {
    	if t, ok := nameToC[s]; ok {
    		return t
    	}
    
    	if t, ok := strings.CutPrefix(s, "struct_"); ok {
    		return "struct " + t
    	}
    	if t, ok := strings.CutPrefix(s, "union_"); ok {
    		return "union " + t
    	}
    	if t, ok := strings.CutPrefix(s, "enum_"); ok {
    		return "enum " + t
    	}
    	if t, ok := strings.CutPrefix(s, "sizeof_"); ok {
    		return "sizeof(" + cname(t) + ")"
    	}
    	return s
    }
    
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Sep 18 15:07:34 UTC 2024
    - 97.1K bytes
    - Viewed (0)
  2. 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
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Mon Aug 19 19:09:04 UTC 2024
    - 61.2K bytes
    - Viewed (0)
Back to top