breite dynamisch anpassen

This commit is contained in:
Özgür Kesim 2015-07-28 10:18:22 +02:00
parent a3f3e65049
commit d40e1cab7c

17
dict.go
View File

@ -56,12 +56,25 @@ func main() {
return return
} }
for i, _ := range left { ml := 5
for _, v := range right {
if len(v) > ml {
ml = len(v)
}
}
if ml > 40 {
ml = 40
}
for i, _ := range right {
a := strings.Trim(right[i], `"`) a := strings.Trim(right[i], `"`)
b := strings.Trim(left[i], `"`) b := strings.Trim(left[i], `"`)
if a == "" { if a == "" {
continue continue
} }
fmt.Printf("%25s → %s\n", a, b) // TODO: wrap when len(a) > ml
fmt.Printf("%*s → %s\n", ml, a, b)
} }
} }