- Sort Score
- Result 10 results
- Languages All
Results 1 - 5 of 5 for CutPrefix (0.54 sec)
-
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) -
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) -
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) -
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) -
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
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Fri Feb 17 21:23:32 UTC 2023 - 602.6K bytes - Viewed (0)