(s string)
| 23 | } |
| 24 | |
| 25 | func StringWidth(s string) int { |
| 26 | // We are intentionally not using a range loop here, because that would |
| 27 | // convert the characters to runes, which is unnecessary work in this case. |
| 28 | for i := range len(s) { |
| 29 | if s[i] > unicode.MaxASCII { |
| 30 | return uniseg.StringWidth(s) |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | return len(s) |
| 35 | } |
| 36 | |
| 37 | // WithPadding pads a string as much as you want |
| 38 | func WithPadding(str string, padding int, alignment Alignment) string { |
no outgoing calls