Geektool output not lining up7/12/2023 ![]() ![]() String.FormatColumn takes width and text for every column. String.FormatSimpleColumn takes width once, and uses that for all columns, repeat text only. ), String.FormatSimpleColumn( _width,, and String.FormatColumnEx( _empty_chars. It is fantastic for debugging, and output. It's pretty basic - convert tabs to spaces, count the length of columns, add spaces if there are too many - if there is too much text then chop it ( my other solution has a buffer you can use or border so border chars show up, and to force 1 blank char minimum between columns - I haven't had a chance to add it in the Python variant yet ), etc. The example function shows Truncate in use ( note: some logic costs aren't necessary, still moving things around - for instance the if _truncate. However, as I created an alternate solution, I'll go ahead and post my solution here so you can see how user-friendly my solution - one of my complaints with Python is some of the formatting is less than intuitive such as the Ternary Operator of False, True ( Honestly, True, False would be better order along with having the statement first ), and others are just strange. Knowing Python has its own solution, I'll be looking into integrating it into my current solution. I wasn't aware Python has a solution for formatting columns until now - I decided to look into it just in case it did as I already created my own solution for another language which doesn't have a built-in solution ( Lua ) and as Logic is Universal, I ported it to Python in a few key-strokes.
0 Comments
Leave a Reply. |