mirror of
https://github.com/zu1k/nali.git
synced 2025-01-23 21:59:02 +08:00
13 lines
311 B
Go
13 lines
311 B
Go
package tools
|
|
|
|
import "strings"
|
|
|
|
func ReplaceAdd(origin string, old string, new string) string {
|
|
subLen := len(new) - len(old)
|
|
wanted := old + strings.Repeat(" ", subLen)
|
|
if strings.Contains(origin, wanted) {
|
|
return strings.ReplaceAll(origin, wanted, new)
|
|
}
|
|
return strings.ReplaceAll(origin, old, new)
|
|
}
|