static S asciiSideBySide(L<S> texts) { if (l(texts) < 2) ret unnull(first(texts)); if (l(texts) > 2) // nicely inefficient :) ret asciiSideBySide(ll(asciiSideBySide(dropLast(texts)), last(texts))); L<S> l1 = lines(first(texts)), l2 = lines(second(texts)); int col1 = maxStringLength(l1), n = max(l(l1), l(l2)); new StringBuilder buf; for i to n: buf.append(rpad(unnull(get(l1, i)), col1)) .append(unnull(get(l2, i))).append("\n"); ret str(buf); }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1014814 |
| Snippet name: | asciiSideBySide - ASCII is a synonym for nonproportional text here |
| Eternal ID of this version: | #1014814/3 |
| Text MD5: | d1e303251bcbdc02bd56aa136188b940 |
| Author: | stefan |
| Category: | javax / ascii |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-05-03 14:57:28 |
| Source code size: | 485 bytes / 12 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 576 / 623 |
| Version history: | 2 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1014816 - asciiSideBySideWithBars |