Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for IndexRune (0.2 sec)

  1. 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.
    //
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Sun Mar 10 21:09:36 GMT 2024
    - 13.3K bytes
    - Viewed (0)
  2. src/bytes/example_test.go

    	fmt.Println(bytes.IndexAny([]byte("crwth"), "aeiouy"))
    	// Output:
    	// 2
    	// -1
    }
    
    func ExampleIndexRune() {
    	fmt.Println(bytes.IndexRune([]byte("chicken"), 'k'))
    	fmt.Println(bytes.IndexRune([]byte("chicken"), 'd'))
    	// Output:
    	// 4
    	// -1
    }
    
    func ExampleJoin() {
    	s := [][]byte{[]byte("foo"), []byte("bar"), []byte("baz")}
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
  3. src/bytes/bytes.go

    	return bytealg.LastIndexByte(s, c)
    }
    
    // IndexRune interprets s as a sequence of UTF-8-encoded code points.
    // It returns the byte index of the first occurrence in s of the given rune.
    // It returns -1 if rune is not present in s.
    // If r is utf8.RuneError, it returns the first instance of any
    // invalid UTF-8 byte sequence.
    func IndexRune(s []byte, r rune) int {
    	switch {
    	case 0 <= r && r < utf8.RuneSelf:
    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)
  4. 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 {
    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)
  5. src/cmd/asm/internal/lex/input.go

    func predefine(defines flags.MultiFlag) map[string]*Macro {
    	macros := make(map[string]*Macro)
    	for _, name := range defines {
    		value := "1"
    		i := strings.IndexRune(name, '=')
    		if i > 0 {
    			name, value = name[:i], name[i+1:]
    		}
    		tokens := Tokenize(name)
    		if len(tokens) != 1 || tokens[0].ScanToken != scanner.Ident {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Tue Aug 29 07:48:38 GMT 2023
    - 12.6K bytes
    - Viewed (0)
  6. doc/go1.17_spec.html

    result parameters, the function body's statement list must end in
    a <a href="#Terminating_statements">terminating statement</a>.
    </p>
    
    <pre>
    func IndexRune(s string, r rune) int {
    	for i, c := range s {
    		if c == r {
    			return i
    		}
    	}
    	// invalid: missing return statement
    }
    </pre>
    
    <p>
    HTML
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Thu Apr 11 20:22:45 GMT 2024
    - 211.6K bytes
    - Viewed (0)
  7. doc/go_spec.html

    result parameters, the function body's statement list must end in
    a <a href="#Terminating_statements">terminating statement</a>.
    </p>
    
    <pre>
    func IndexRune(s string, r rune) int {
    	for i, c := range s {
    		if c == r {
    			return i
    		}
    	}
    	// invalid: missing return statement
    }
    </pre>
    
    <p>
    HTML
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Apr 26 00:39:16 GMT 2024
    - 279.6K bytes
    - Viewed (0)
  8. api/go1.txt

    pkg bytes, func Index([]uint8, []uint8) int
    pkg bytes, func IndexAny([]uint8, string) int
    pkg bytes, func IndexByte([]uint8, uint8) int
    pkg bytes, func IndexFunc([]uint8, func(int32) bool) int
    pkg bytes, func IndexRune([]uint8, int32) int
    pkg bytes, func Join([][]uint8, []uint8) []uint8
    pkg bytes, func LastIndex([]uint8, []uint8) int
    pkg bytes, func LastIndexAny([]uint8, string) int
    Plain Text
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Aug 14 18:58:28 GMT 2013
    - 1.7M bytes
    - Viewed (1)
Back to top