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

10
LINES

< > BotCompany Repo | #1025454 // format3_curlyIfMultiToken

JavaX fragment (include)

sS format3_curlyIfMultiToken(S pat, S... args) {
  if (args.length == 0) return pat;
  
  L<S> tok = javaTok(pat);
  int argidx = 0;
  for (int i = 1; i < tok.size(); i += 2)
    if (tok.get(i).equals("*"))
      tok.set(i, curlyBraceIfMultipleTokens(argidx < args.length ? args[argidx++] : "null"));
  return join(tok);
}

Author comment

Began life as a copy of #1021066

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: #1025454
Snippet name: format3_curlyIfMultiToken
Eternal ID of this version: #1025454/1
Text MD5: 3aded468720b57aaba653353d1c14a8a
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-29 01:29:05
Source code size: 331 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 191 / 230
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)