1 | // split at newline, but also take into account multi-line strings |
2 | static L<S> splitScript(S script) {
|
3 | L<S> tok = javaTok(script); |
4 | new L<S> result; |
5 | result.add("");
|
6 | for (int i = 0; i < tok.size(); i++) {
|
7 | boolean nl = tok.get(i).indexOf("\n") >= 0;
|
8 | if (nl) |
9 | result.add("");
|
10 | else |
11 | result.set(result.size()-1, result.get(result.size()-1) + tok.get(i)); |
12 | } |
13 | return result; |
14 | } |
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: | 852 / 1092 |
| Referenced in: | [show references] |