Libraryless. Click here for Pure Java version (2545L/16K).
1 | // Convert all spacing to a single space, so everything's neat & on one line. |
2 | static L<S> simpleSpacesAndTrim(L<S> tok) { |
3 | tok = cloneList(tok); |
4 | int n = l(tok); |
5 | for (int i = 0; i < n; i += 2) |
6 | tok.set(i, i == 0 || i == n-1 || empty(tok.get(i)) ? "" : " "); |
7 | ret tok; |
8 | } |
9 | |
10 | sS simpleSpacesAndTrim(S s) { |
11 | ret join(simpleSpacesAndTrim(nlTok(s))); |
12 | } |
Began life as a copy of #1001975
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1028695 |
Snippet name: | simpleSpacesAndTrim |
Eternal ID of this version: | #1028695/1 |
Text MD5: | f04157c0dbb9a7e0e995cd37bf49f54a |
Transpilation MD5: | b4c84cfc9e9a82afc16d454dfdfacd67 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-05 21:25:23 |
Source code size: | 364 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 214 / 300 |
Referenced in: | [show references] |