Home | History | Annotate | Download | only in strings

Lines Matching refs:substr

27 // Index returns the index of the first instance of substr in s, or -1 if substr is not present in s.
28 func Index(s, substr string) int {
29 n := len(substr)
34 return IndexByte(s, substr[0])
36 if substr == s {
43 // Use brute force when s and substr both are small
45 return indexShortStr(s, substr)
47 c := substr[0]
61 if s[i:i+n] == substr {
70 r := indexShortStr(s[i:], substr)
79 return indexRabinKarp(s, substr)
82 // Count counts the number of non-overlapping instances of substr in s.
83 // If substr is an empty string, Count returns 1 + the number of Unicode code points in s.
84 func Count(s, substr string) int {
85 return countGeneric(s, substr)