Pad String Right position This would place string at the left side of the screen
(s, pad string, width int)
| 28 | // Pad String Right position |
| 29 | // This would place string at the left side of the screen |
| 30 | func padRight(s, pad string, width int) string { |
| 31 | gap := width - displayWidth(s) |
| 32 | if gap > 0 { |
| 33 | return s + strings.Repeat(string(pad), gap) |
| 34 | } |
| 35 | return s |
| 36 | } |
| 37 | |
| 38 | func displayWidth(str string) int { |
| 39 | return runewidth.StringWidth(ansi.ReplaceAllLiteralString(str, "")) |
no test coverage detected