package tprint import ( "strings" "unicode" ) func maxLengthStr(a, b string) string { if strLen(a) > strLen(b) { return a } return b } func maxLengthSlice[T any](a, b []T) []T { if len(a) > len(b) { return a } return b } func strLen(str string) int { l := 0 runes := []rune(str) colored := false for i := 0; i < len(runes); i++ { if unicode.IsControl(runes[i]) { if colored { i += 3 } else { i += 4 } colored = !colored continue } l++ } return l } func padStringRight(str string, pad rune, length int) string { padding := length - strLen(str) return str + strings.Repeat(string(pad), padding) }