Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for indexFunc (0.17 sec)

  1. src/bytes/bytes.go

    	if HasSuffix(s, suffix) {
    		return s[:len(s)-len(suffix)]
    	}
    	return s
    }
    
    // IndexFunc interprets s as a sequence of UTF-8-encoded code points.
    // It returns the byte index in s of the first Unicode
    // code point satisfying f(c), or -1 if none do.
    func IndexFunc(s []byte, f func(r rune) bool) int {
    	return indexFunc(s, f, true)
    }
    
    // LastIndexFunc interprets s as a sequence of UTF-8-encoded code points.
    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)
  2. src/bytes/example_test.go

    	// Output:
    	// 4
    	// -1
    }
    
    func ExampleIndexFunc() {
    	f := func(c rune) bool {
    		return unicode.Is(unicode.Han, c)
    	}
    	fmt.Println(bytes.IndexFunc([]byte("Hello, 世界"), f))
    	fmt.Println(bytes.IndexFunc([]byte("Hello, world"), f))
    	// Output:
    	// 7
    	// -1
    }
    
    func ExampleIndexAny() {
    	fmt.Println(bytes.IndexAny([]byte("chicken"), "aeiouy"))
    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. cni/pkg/nodeagent/podcgroupns.go

    		inode:   inode,
    	}, nil
    }
    
    func isProcess(entry fs.DirEntry) bool {
    	// check if it is a directory
    	if !entry.IsDir() {
    		return false
    	}
    
    	// check if it is a number
    	if strings.IndexFunc(entry.Name(), isNotNumber) != -1 {
    		return false
    	}
    	return true
    }
    
    func GetFd(f fs.File) (uintptr, error) {
    	if fdable, ok := f.(interface{ Fd() uintptr }); ok {
    		return fdable.Fd(), nil
    	}
    
    Go
    - Registered: Wed May 08 22:53:08 GMT 2024
    - Last Modified: Fri Apr 12 21:47:31 GMT 2024
    - 11K bytes
    - Viewed (0)
  4. src/archive/tar/reader.go

    			// For Format detection, check if block is properly formatted since
    			// the parser is more liberal than what USTAR actually permits.
    			notASCII := func(r rune) bool { return r >= 0x80 }
    			if bytes.IndexFunc(tr.blk[:], notASCII) >= 0 {
    				hdr.Format = FormatUnknown // Non-ASCII characters in block.
    			}
    			nul := func(b []byte) bool { return int(b[len(b)-1]) == 0 }
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Mar 08 01:59:14 GMT 2024
    - 26.8K bytes
    - Viewed (0)
  5. cmd/sts-handlers_test.go

    		Policy: []string{policy},
    	})
    	if err != nil {
    		c.Fatalf("GetLDAPPolicyEntities should not fail: %v", err)
    	}
    	{
    		// Check that the mapping we created exists.
    		idx := slices.IndexFunc(policyResult.PolicyMappings, func(e madmin.PolicyEntities) bool {
    			return e.Policy == policy && slices.Contains(e.Groups, actualGroupDN)
    		})
    		if !(idx >= 0) {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Apr 25 15:50:16 GMT 2024
    - 85.7K bytes
    - Viewed (0)
  6. 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 May 05 19:28:20 GMT 2024
    - Last Modified: Sun Mar 10 21:09:36 GMT 2024
    - 13.3K bytes
    - Viewed (0)
  7. 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 May 07 11:14:38 GMT 2024
    - Last Modified: Thu Apr 11 20:22:45 GMT 2024
    - 211.6K bytes
    - Viewed (0)
  8. 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 May 07 11:14:38 GMT 2024
    - Last Modified: Thu May 02 22:43:51 GMT 2024
    - 279.6K bytes
    - Viewed (0)
Back to top