MCPcopy
hub / github.com/spicetify/cli / Replace

Function Replace

src/utils/utils.go:167–173  ·  view source on GitHub ↗

Replace uses Regexp to find any matched from `input` with `regexpTerm` and replaces them with `replaceTerm` then returns new string.

(str *string, pattern string, repl func(submatches ...string) string)

Source from the content-addressed store, hash-verified

165// Replace uses Regexp to find any matched from `input` with `regexpTerm`
166// and replaces them with `replaceTerm` then returns new string.
167func Replace(str *string, pattern string, repl func(submatches ...string) string) {
168 re := regexp.MustCompile(pattern)
169 *str = re.ReplaceAllStringFunc(*str, func(match string) string {
170 submatches := re.FindStringSubmatch(match)
171 return repl(submatches...)
172 })
173}
174
175func ReplaceOnce(str *string, pattern string, repl func(submatches ...string) string) {
176 re := regexp.MustCompile(pattern)

Callers 7

htmlModFunction · 0.92
insertCustomAppFunction · 0.92
applyPatchesFunction · 0.92
StartFunction · 0.92
disableSentryFunction · 0.92
exposeAPIs_mainFunction · 0.92
exposeAPIs_vendorFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected