Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for genericReplacer (0.18 sec)

  1. src/strings/export_test.go

    package strings
    
    func (r *Replacer) Replacer() any {
    	r.once.Do(r.buildOnce)
    	return r.r
    }
    
    func (r *Replacer) PrintTrie() string {
    	r.once.Do(r.buildOnce)
    	gen := r.r.(*genericReplacer)
    	return gen.printNode(&gen.root, 0)
    }
    
    func (r *genericReplacer) printNode(t *trieNode, depth int) (s string) {
    	if t.priority > 0 {
    		s += "+"
    	} else {
    		s += "-"
    	}
    	s += "\n"
    
    	if t.prefix != "" {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 1.1K bytes
    - Viewed (0)
  2. src/strings/replace.go

    	next   *trieNode
    
    	// table is a lookup table indexed by the next byte in the key, after
    	// remapping that byte through genericReplacer.mapping to create a dense
    	// index. In the example above, the keys only use 'a', 'b', 'c', 'x' and
    	// 'y', which remap to 0, 1, 2, 3 and 4. All other bytes remap to 5, and
    	// genericReplacer.tableSize will be 5. Node n0's table will be
    	// []*trieNode{ 0:n1, 1:n4, 3:n6 }, where the 0, 1 and 3 are the remapped
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:10:31 UTC 2023
    - 14.5K bytes
    - Viewed (0)
  3. src/strings/replace_test.go

    	{NewReplacer("12", "123"), "*strings.singleStringReplacer"},
    	{NewReplacer("1", "12"), "*strings.byteStringReplacer"},
    	{NewReplacer("", "X"), "*strings.genericReplacer"},
    	{NewReplacer("a", "1", "b", "12", "cde", "123"), "*strings.genericReplacer"},
    }
    
    // TestPickAlgorithm tests that NewReplacer picks the correct algorithm.
    func TestPickAlgorithm(t *testing.T) {
    	for i, tc := range algorithmTestCases {
    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