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

14
LINES

< > BotCompany Repo | #1027764 // formatWithFragments

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

Libraryless. Click here for Pure Java version (2732L/17K).

sO formatWithFragments(S starPattern, O... args) {
  L tok = javaTok(starPattern);
  int iArg = 0, i = 1;
  new L out;
  while (i < l(tok)) {
    int j = smartIndexOf(tok, i, "*");
    if (j > i)
      out.add(Fragment(joinSubList(tok, i, j-1)));
    if (j < l(tok))
      out.add(args[iArg++]);
    i = j+2;
  }
  ret l(out) == 1 ? first(out) : out;
}

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: #1027764
Snippet name: formatWithFragments
Eternal ID of this version: #1027764/6
Text MD5: 7ca431a0b379adbefc3b44d7086f47eb
Transpilation MD5: f11855abb3ce598ebd18911ae200fff9
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-10 02:16:55
Source code size: 365 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 133 / 233
Version history: 5 change(s)
Referenced in: [show references]