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

13
LINES

< > BotCompany Repo | #1025589 - tok_dropRoundBrackets - but not the contents of brackets

JavaX fragment (include)

sS tok_dropRoundBrackets(S s) {
  ret join(tok_dropRoundBrackets(javaTok(s)));
}

static LS tok_dropRoundBrackets(LS tok) {
  for (int i = 1; i < l(tok); i+= 2) {
    while (eqGetOneOf(tok, i, "(", ")")) {
      tokAppend(tok, i-1, tok.get(i+1));
      removeSubList(tok, i, i+2);
    }
  }
  ret tok;
}

Author comment

Began life as a copy of #1020926

download  show line numbers  debug dex   

Travelled to 2 computer(s): mqqgnosmbjvj, tvejysmllsmz

No comments. add comment

Snippet ID: #1025589
Snippet name: tok_dropRoundBrackets - but not the contents of brackets
Eternal ID of this version: #1025589/2
Text MD5: a9f76a96c348b6682796f3548dbf9347
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-05 18:03:22
Source code size: 315 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 10 / 18
Version history: 1 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1025589 & http://1025589.tinybrain.de