Neat String interpolation
I have this little something, and I want the counter to stay fixed width so
[ 1/50]
instead of [1/50]
how can I do this ?
As simple as possible, I just want it to look neat not write a TUI framework.
I found $"{val , fixedWidth}"
but that only works with constants so it can't adapt if I reach 100 files.12 Replies
{file.Nr,2}
IIRC?
Or -2
One is leftpad, other is rightpad
Can't remember which is whichI suppose that's the best it's gonna get, thx
omg please assign
files.Count.ToString().Length
to a variable outside the foreach instead of calculating it every cycle
also if you do that you can use the format inside the $"..."
like {fileNr,pad}
like Z²⁵ saidno
{value,pad}
requests a const value, so i can't calculate it after loading my files.thx but, we were done already
I know this has been solved already but there is a decent CUI framework thingy that I found pretty nice for looking things pretty https://github.com/spectreconsole/spectre.console
GitHub
GitHub - spectreconsole/spectre.console: A .NET library that makes ...
A .NET library that makes it easier to create beautiful console applications. - GitHub - spectreconsole/spectre.console: A .NET library that makes it easier to create beautiful console applications.
for example I have an app that displays progress like this
And it wasn't what I looked for, for that specific script. But it looks very interesting to have in my Toolbox, so Thank you very much regardless.
yeah, not really what you asked for but it is a great lib if you write a lot of CLI stuffs :D