Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1025839 // tlft_honoringTokens - token-aware tlft

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2384L/15K).

static LS tlft_honoringTokens(S s) {
  new L<Int> indices;
  LS tok = javaTok(s);
  new LS out;
  int start = 0;
  for (int i = 2; i+1 < l(tok); i += 2) {
    continue unless containsNewLine(tok.get(i));
    addIfNempty(out, trimJoinSubList(tok, start, i));
    start = i+1;
  }
  if (start < l(tok))
    addIfNempty(out, trimJoinSubList(tok, start));
  ret out;
}

Author comment

Began life as a copy of #1025618

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: #1025839
Snippet name: tlft_honoringTokens - token-aware tlft
Eternal ID of this version: #1025839/3
Text MD5: 8d8951a42a1b0fd68bd6fa24e282056c
Transpilation MD5: f316e7bce0acd1735aee84eda5dc4b9e
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-26 03:15:20
Source code size: 377 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 196 / 295
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)