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).

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

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: 205 / 301
Version history: 1 change(s)
Referenced in: [show references]