Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for byteReplacer (0.32 sec)

  1. src/strings/replace.go

    	}
    	wn, err = sw.WriteString(s[i:])
    	n += wn
    	return
    }
    
    // byteReplacer is the implementation that's used when all the "old"
    // and "new" values are single ASCII bytes.
    // The array contains replacement bytes indexed by old byte.
    type byteReplacer [256]byte
    
    func (r *byteReplacer) Replace(s string) string {
    	var buf []byte // lazily allocated
    	for i := 0; i < len(s); i++ {
    		b := s[i]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:10:31 UTC 2023
    - 14.5K bytes
    - Viewed (0)
  2. src/strings/replace_test.go

    				i, tc.in, n, len(tc.out), tc.out)
    		}
    	}
    }
    
    var algorithmTestCases = []struct {
    	r    *Replacer
    	want string
    }{
    	{capitalLetters, "*strings.byteReplacer"},
    	{htmlEscaper, "*strings.byteStringReplacer"},
    	{NewReplacer("12", "123"), "*strings.singleStringReplacer"},
    	{NewReplacer("1", "12"), "*strings.byteStringReplacer"},
    	{NewReplacer("", "X"), "*strings.genericReplacer"},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 24 22:53:05 UTC 2017
    - 14.1K bytes
    - Viewed (0)
Back to top