I want to print a horizontal line to the console. At the moment, I use -----
, but there are small spaces between the single characters.
Is there a better character I might use?
_
is not a viable option, as it is not vertically centered. Is there something like a middlescore, strikethrough (or whatever it's name is) character?
In more simple terms, a horizontal line on any chart is where the y-axis values are equal. If it has been drawn to show a series of highs in the data, a data point moving above the horizontal line would indicate a rise in the y-axis value over recent values in the data sample.
Here the ASCII value u'\u2500' relates to hyphen without spaces at start and end. The \u specifies the following string is in extended ASCII form and 2500 denotes the ─ symbol. U+2550 is a double stroke ═ like =.
Hyphen ---------------------
Underscore _____________________
EM Dash —————————————————————
Horizontal Bar ―――――――――――――――――――――
Horizontal Box ─────────────────────
There is a big list of characters to try over at wikipedia.
The horizontal box drawing character is my recommendation. It is designed for this purpose
With bash
, to display a horizontal rule the size of your window you can use:
printf %"$COLUMNS"s | tr " " "-"
With zsh
, you could avoid the tr
:
printf '—%.0s' {1..$COLUMNS}
NOTE: I know this is not what OP wants, but it is what I think someone from Google could be seeking.
Unicode character \u2500
solved it for me. According to Wikipedia it is for box drawings light horizontal
, which is exactly what I need :-)
Thanks @Gusdor for pointing me to the correct Wikipedia article!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With