- Sort Score
- Result 10 results
- Languages All
Results 1 - 7 of 7 for hasPathPrefix (0.21 sec)
-
staging/src/k8s.io/apiserver/pkg/storage/cacher/util.go
limitations under the License. */ package cacher import ( "strings" ) // hasPathPrefix returns true if the string matches pathPrefix exactly, or if is prefixed with pathPrefix at a path segment boundary func hasPathPrefix(s, pathPrefix string) bool { // Short circuit if s doesn't contain the prefix at all if !strings.HasPrefix(s, pathPrefix) { return false }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Fri Dec 15 07:09:11 UTC 2023 - 1.3K bytes - Viewed (0) -
src/cmd/internal/objabi/line.go
// For portability, we allow ASCII case folding, so that hasPathPrefix("a/b/c", "A/B") is true. // Similarly, we allow slash folding, so that hasPathPrefix("a/b/c", "a\\b") is true. // We do not allow full Unicode case folding, for fear of causing more confusion // or harm than good. (For an example of the kinds of things that can go wrong, // see http://article.gmane.org/gmane.linux.kernel/1853266.) func hasPathPrefix(s string, t string) bool { if len(t) > len(s) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Jan 17 23:10:31 UTC 2023 - 3.8K bytes - Viewed (0) -
src/cmd/internal/pkgpattern/pkgpattern.go
if strings.Contains(name, vendorChar) { return false } name = replaceVendor(name, vendorChar) } return reg.MatchString(name) } } // hasPathPrefix reports whether the path s begins with the // elements in prefix. func hasPathPrefix(s, prefix string) bool { switch { default: return false case len(s) == len(prefix): return s == prefix case len(s) > len(prefix):
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Sep 27 16:43:40 UTC 2022 - 4.8K bytes - Viewed (0) -
src/cmd/go/internal/str/path.go
// license that can be found in the LICENSE file. package str import ( "os" "path/filepath" "runtime" "strings" ) // HasPathPrefix reports whether the slash-separated path s // begins with the elements in prefix. func HasPathPrefix(s, prefix string) bool { if len(s) == len(prefix) { return s == prefix } if prefix == "" { return true } if len(s) > len(prefix) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Jan 31 20:33:02 UTC 2023 - 3.9K bytes - Viewed (0) -
src/cmd/go/internal/str/str_test.go
{"foo/bar", "foo/", true}, {"foo/bar", "/foo", false}, {"foo/bar", "foo/bar", true}, {"foo/bar", "foo/bar/", false}, {"foo/bar", "/foo/bar", false}, } { got := HasPathPrefix(tt.s, tt.prefix) if got != tt.want { t.Errorf("HasPathPrefix(%q, %q) = %v; want %v", tt.s, tt.prefix, got, tt.want) } } } func TestTrimFilePathPrefixSlash(t *testing.T) { if os.PathSeparator != '/' {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Jan 25 16:49:13 UTC 2023 - 5.4K bytes - Viewed (0) -
src/cmd/internal/pkgpattern/pat_test.go
{"abc", "a", false}, {"a/bc", "a", true}, {"a", "a", true}, {"a/bc", "a/", true}, } func TestHasPathPrefix(t *testing.T) { testStringPairs(t, "hasPathPrefix", hasPathPrefixTests, hasPathPrefix) } type stringPairTest struct { in1 string in2 string out bool } func testStringPairs(t *testing.T, name string, tests []stringPairTest, f func(string, string) bool) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Sep 27 16:43:40 UTC 2022 - 4.4K bytes - Viewed (0) -
cmd/import-boss/main_test.go
base: "/foobar/qux", pfx: "/foo", expect: false, }, { base: "/foo/bar/bat/qux/zrb", pfx: "/foo/bar/bat", expect: true, }} for _, tc := range cases { ret := hasPathPrefix(tc.base, tc.pfx) if ret != tc.expect { t.Errorf("expected %v, got %v: (%q, %q)", tc.expect, ret, tc.base, tc.pfx) } } } func checkAllErrorStrings(t *testing.T, errs []error, expect []string) {
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Thu May 16 12:36:49 UTC 2024 - 8.8K bytes - Viewed (0)