lineCount returns the number of terminal lines in s.
(s string)
| 24 | |
| 25 | // lineCount returns the number of terminal lines in s. |
| 26 | func lineCount(s string) int { |
| 27 | if s == "" { |
| 28 | return 0 |
| 29 | } |
| 30 | return strings.Count(s, "\n") + 1 |
| 31 | } |
| 32 | |
| 33 | // boxWithTitle renders content in a rounded-border box whose title is embedded |
| 34 | // in the top border line: |