// split at newline, but also take into account multi-line strings static L<S> splitScript(S script) { L<S> tok = javaTok(script); new L<S> result; result.add(""); for (int i = 0; i < tok.size(); i++) { boolean nl = tok.get(i).indexOf("\n") >= 0; if (nl) result.add(""); else result.set(result.size()-1, result.get(result.size()-1) + tok.get(i)); } return result; }
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: | #1000848 |
Snippet name: | splitScript |
Eternal ID of this version: | #1000848/1 |
Text MD5: | 9b3779609275f689bca5a929bde41cff |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-08-30 16:18:21 |
Source code size: | 417 bytes / 14 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 644 / 873 |
Referenced in: | #1002427 - Accellerating 629 (SPIKE) #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |