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

10
LINES

< > BotCompany Repo | #1028873 // format_flex - with argument formatter

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

Libraryless. Click here for Pure Java version (2552L/16K).

sS format_flex(IF1<O, S> argumentFormatter, S pat, O... args) {
  if (empty(args)) return pat;
  
  LS tok = javaTokPlusPeriod(pat);
  int argidx = 0;
  for (int i = 1; i < tok.size(); i += 2)
    if (tok.get(i).equals("*"))
      tok.set(i, argumentFormatter.get(argidx < args.length ? args[argidx++] : null));
  ret join(tok);
}

Author comment

Began life as a copy of #1001250

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028873
Snippet name: format_flex - with argument formatter
Eternal ID of this version: #1028873/2
Text MD5: f83b317ae74c85dd80552ab7284933ae
Transpilation MD5: 5d1eeec9fd9baff18b3e13d562bb0cc7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-10 18:28:37
Source code size: 339 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 147 / 226
Version history: 1 change(s)
Referenced in: [show references]