Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for simpleIndex (0.18 sec)

  1. src/strings/strings_test.go

    		actual := LastIndexByte(test.s, test.sep[0])
    		if actual != test.out {
    			t.Errorf("LastIndexByte(%q,%c) = %v; want %v", test.s, test.sep[0], actual, test.out)
    		}
    	}
    }
    
    func simpleIndex(s, sep string) int {
    	n := len(sep)
    	for i := n; i <= len(s); i++ {
    		if s[i-n:i] == sep {
    			return i - n
    		}
    	}
    	return -1
    }
    
    func TestIndexRandom(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 12:58:37 UTC 2024
    - 53K bytes
    - Viewed (0)
Back to top