| Total Lines | 7 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package utils |
||
| 2 | |||
| 3 | import "strings" |
||
| 4 | |||
| 5 | func CenterString(str string, width int) string { |
||
| 6 | spaces := int(float64(width-len(str)) / 2) |
||
| 7 | return strings.Repeat(" ", spaces) + str + strings.Repeat(" ", width-(spaces+len(str))) |
||
| 8 | } |
||
| 9 |