Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for IndexBytePortable (0.07 sec)

  1. src/bytes/bytes_test.go

    			continue
    		}
    		a := []byte(tt.a)
    		b := tt.b[0]
    		pos := IndexByte(a, b)
    		if pos != tt.i {
    			t.Errorf(`IndexByte(%q, '%c') = %v`, tt.a, b, pos)
    		}
    		posp := IndexBytePortable(a, b)
    		if posp != tt.i {
    			t.Errorf(`indexBytePortable(%q, '%c') = %v`, tt.a, b, posp)
    		}
    	}
    }
    
    func TestLastIndexByte(t *testing.T) {
    	testCases := []BinOpTest{
    		{"", "q", -1},
    		{"abcdef", "q", -1},
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Mon Aug 19 19:09:04 UTC 2024
    - 61.2K bytes
    - Viewed (0)
  2. src/bytes/bytes.go

    	return IndexFunc(b, f) >= 0
    }
    
    // IndexByte returns the index of the first instance of c in b, or -1 if c is not present in b.
    func IndexByte(b []byte, c byte) int {
    	return bytealg.IndexByte(b, c)
    }
    
    func indexBytePortable(s []byte, c byte) int {
    	for i, b := range s {
    		if b == c {
    			return i
    		}
    	}
    	return -1
    }
    
    // LastIndex returns the index of the last instance of sep in s, or -1 if sep is not present in s.
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Sep 03 20:55:15 UTC 2024
    - 35.6K bytes
    - Viewed (0)
Back to top