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

19
LINES

< > BotCompany Repo | #1028750 // formatWithFragmentsAndDollarSymVars_asList

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

Libraryless. Click here for Pure Java version (3099L/20K).

1  
sL formatWithFragmentsAndDollarSymVars_asList(S starPattern, O... args) {
2  
  LS tok = javaTok(starPattern);
3  
  int iArg = 0, i = 1;
4  
  new L out;
5  
  while (i < l(tok)) {
6  
    int j = smartIndexOfAsteriskOrDollarVar(tok, i);
7  
    if (j > i)
8  
      out.add(Fragment(joinSubList(tok, i, j-1)));
9  
    if (j < l(tok)) {
10  
      S t = tok.get(j);
11  
      if (eq(t, "*"))
12  
        out.add(get(args, iArg++));
13  
      else
14  
        out.add(SymVar(t));
15  
    }
16  
    i = j+2;
17  
  }
18  
  ret out;
19  
}

Author comment

Began life as a copy of #1027879

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: #1028750
Snippet name: formatWithFragmentsAndDollarSymVars_asList
Eternal ID of this version: #1028750/1
Text MD5: 7e50e9c6f3c9a76551322ec19664efe3
Transpilation MD5: df76e6e786457eaad43b60a4f5f3b4c2
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-07 00:13:45
Source code size: 481 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 215 / 302
Referenced in: [show references]