code: func (r *replacer) Replace(s string) string {
  	// Do not attempt replacements if no placeholder is found.
  	if !strings.ContainsAny(s, "{}") {
  		return s
  	}
  
  	result := ""
  	for {
  		idxStart := strings.Index(s, "{")
  		if idxStart == -1 {
  			// no placeholder anymore
  			break
  		}
  		idxEnd := strings.Index(s[idxStart:], "}")
  		if idxEnd == -1 {
  			// unpaired placeholder
  			break
  		}
  		idxEnd += idxStart
  
  		// get a replacement
  		placeholder := s[idxStart : idxEnd+1]
  		replacement := r.getSubstitution(placeholder)
  
  		// append prefix + replacement
  		result += s[:idxStart] + replacement
  
  		// strip out scanned parts
  		s = s[idxEnd+1:]
  	}
  
  	// append unscanned parts
  	return result + s
  }
docs: // Replace performs a replacement of values on s and returns
  // the string with the replaced values.