Libraryless. Click here for Pure Java version (1747L/11K).
static LS paragraphsTok(S s) { new ArrayList<S> tok; int l = s == null ? 0 : s.length(); int i = 0; while (i < l && isSpace(s.charAt(i))) ++i; tok.add(substring(s, 0, i)); while true { IntRange r = tok_findNextEmptyLineWhitespace(s, i); if (r == null) break; tok.add(substring(s, i, r.start)); tok.add(substring(s, r)); i = r.end; } if (i < l) { int l2 = l; while (l2 > i+1 && isSpace(s.charAt(l2-1))) --l2; tok.add(substring(s, i, l2)); tok.add(substring(s, l2)); } ret tok; }
Began life as a copy of #1003360
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023728 |
Snippet name: | paragraphsTok - find content separated by empty lines. returns CNC. trims paragraphs |
Eternal ID of this version: | #1023728/8 |
Text MD5: | a46203e9f45e2a72c3845a5a028b1379 |
Transpilation MD5: | 8c6fdbe3ee823f7924aa091820138557 |
Author: | stefan |
Category: | javax / tokenizing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-07-07 18:29:09 |
Source code size: | 569 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 200 / 297 |
Version history: | 7 change(s) |
Referenced in: | [show references] |