You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
packer/builder/azure/common/gluestrings.go

20 lines
338 B

package common
// removes overlap between the end of a and the start of b and
// glues them together
func GlueStrings(a, b string) string {
shift := 0
for shift < len(a) {
i := 0
for (i+shift < len(a)) && (i < len(b)) && (a[i+shift] == b[i]) {
i++
}
if i+shift == len(a) {
break
}
shift++
}
return a[:shift] + b
}