YTSFlix_Go/vendor/github.com/asticode/go-astitools/string/length.go
2018-11-04 15:58:15 +01:00

16 lines
283 B
Go

package astistring
// ToLength forces the length of a string
func ToLength(i, rpl string, length int) string {
if len(i) == length {
return i
} else if len(i) > length {
return i[:length]
} else {
for idx := 0; idx <= length-len(i); idx++ {
i += rpl
}
return i
}
}