- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 43 for indexRune (0.32 sec)
-
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
comma := strings.IndexRune(value, ',') if comma < 0 { continue } // If the character before a comma is a space, this is suspicious. if comma > 0 && value[comma-1] == ' ' { return errTagValueSpace } value = value[comma+1:] case "json": // JSON allows using spaces in the name, so skip it. comma := strings.IndexRune(value, ',') if comma < 0 { continue
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 09 01:28:01 UTC 2023 - 8.8K bytes - Viewed (0) -
src/strings/strings.go
func TrimFunc(s string, f func(rune) bool) string { return TrimRightFunc(TrimLeftFunc(s, f), f) } // IndexFunc returns the index into s of the first Unicode // code point satisfying f(c), or -1 if none do. func IndexFunc(s string, f func(rune) bool) int { return indexFunc(s, f, true) } // LastIndexFunc returns the index into s of the last // Unicode code point satisfying f(c), or -1 if none do.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 03 16:48:16 UTC 2024 - 31.2K bytes - Viewed (0) -
src/strings/strings_test.go
} for _, tt := range tests { if got := IndexRune(tt.in, tt.rune); got != tt.want { t.Errorf("IndexRune(%q, %d) = %v; want %v", tt.in, tt.rune, got, tt.want) } } haystack := "test世界" allocs := testing.AllocsPerRun(1000, func() { if i := IndexRune(haystack, 's'); i != 2 { t.Fatalf("'s' at %d; want 2", i) } if i := IndexRune(haystack, '世'); i != 4 { t.Fatalf("'世' at %d; want 4", i)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 03 12:58:37 UTC 2024 - 53K bytes - Viewed (0) -
src/strings/example_test.go
fmt.Println(strings.IndexByte("gophers", 'h')) fmt.Println(strings.IndexByte("golang", 'x')) // Output: // 0 // 3 // -1 } func ExampleIndexRune() { fmt.Println(strings.IndexRune("chicken", 'k')) fmt.Println(strings.IndexRune("chicken", 'd')) // Output: // 4 // -1 } func ExampleLastIndex() { fmt.Println(strings.Index("go gopher", "go")) fmt.Println(strings.LastIndex("go gopher", "go"))
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Oct 09 22:05:38 UTC 2023 - 10.7K bytes - Viewed (0) -
tools/bug-report/pkg/util/path/path.go
var r []string for _, str := range pv { if str != "" { str = strings.ReplaceAll(str, escapedPathSeparator, pathSeparator) // Is str of the form node[expr], convert to "node", "[expr]"? nBracket := strings.IndexRune(str, '[') if nBracket > 0 { r = append(r, str[:nBracket], str[nBracket:]) } else { // str is "[expr]" or "node" r = append(r, str) } } } return r }
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Tue Sep 01 20:55:53 UTC 2020 - 2.2K bytes - Viewed (0) -
internal/etag/etag.go
// has been uploaded using the S3 singlepart API. // // Parts may panic if the ETag is an invalid multipart // ETag. func (e ETag) Parts() int { if !e.IsMultipart() { return 1 } n := bytes.IndexRune(e, '-') parts, err := strconv.Atoi(string(e[n+1:])) if err != nil { panic(err) // malformed ETag } return parts } // Format returns an ETag that is formatted as specified // by AWS S3. //
Registered: Sun Jun 16 00:44:34 UTC 2024 - Last Modified: Sun Mar 10 21:09:36 UTC 2024 - 13.3K bytes - Viewed (0) -
src/fmt/scan.go
break } s.buf.writeRune(r) } return s.buf } var errComplex = errors.New("syntax error scanning complex number") var errBool = errors.New("syntax error scanning boolean") func indexRune(s string, r rune) int { for i, c := range s { if c == r { return i } } return -1 } // consume reads the next rune in the input and reports whether it is in the ok string.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Apr 02 21:56:20 UTC 2024 - 31.9K bytes - Viewed (0) -
operator/pkg/util/path.go
var r []string for _, str := range pv { if str != "" { str = strings.ReplaceAll(str, EscapedPathSeparator, PathSeparator) // Is str of the form node[expr], convert to "node", "[expr]"? nBracket := strings.IndexRune(str, '[') if nBracket > 0 { r = append(r, str[:nBracket], str[nBracket:]) } else { // str is "[expr]" or "node" r = append(r, str) } } } return r }
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Tue Dec 12 17:12:54 UTC 2023 - 5.5K bytes - Viewed (0) -
src/bytes/bytes_test.go
} for _, tt := range tests { if got := IndexRune([]byte(tt.in), tt.rune); got != tt.want { t.Errorf("IndexRune(%q, %d) = %v; want %v", tt.in, tt.rune, got, tt.want) } } haystack := []byte("test世界") allocs := testing.AllocsPerRun(1000, func() { if i := IndexRune(haystack, 's'); i != 2 { t.Fatalf("'s' at %d; want 2", i) } if i := IndexRune(haystack, '世'); i != 4 {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 03 12:58:37 UTC 2024 - 56.5K bytes - Viewed (0) -
src/encoding/csv/reader.go
parseField: for { if r.TrimLeadingSpace { i := bytes.IndexFunc(line, func(r rune) bool { return !unicode.IsSpace(r) }) if i < 0 { i = len(line) pos.col -= lengthNL(line) } line = line[i:] pos.col += i } if len(line) == 0 || line[0] != '"' { // Non-quoted string field i := bytes.IndexRune(line, r.Comma) field := line if i >= 0 {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon May 13 21:32:28 UTC 2024 - 14.2K bytes - Viewed (0)