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

14
LINES

< > BotCompany Repo | #1034740 // starFormat - simple formatter replacing * with each argument (no tokenizing)

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

Libraryless. Click here for Pure Java version (5330L/29K).

sS starFormat(S pat, O... args) {
  int n = l(pat), iArg = 0, iChar = 0;
  new StringBuilder buf;
  while true {
    int jChar = smartIndexOf(pat, iChar, '*');
    buf.append(substring(pat, iChar, jChar));
    
    if (jChar >= n) break;
    buf.append(str(get(args, iArg++)));
    iChar = jChar+1;
  }
  
  ret str(buf);
}

Author comment

Began life as a copy of #1026690

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034740
Snippet name: starFormat - simple formatter replacing * with each argument (no tokenizing)
Eternal ID of this version: #1034740/6
Text MD5: 7c8ce41d4efe94a99f4317a0ca0728a6
Transpilation MD5: 765caaadcd55dbd5fe287e0dbc506d0c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-08 01:50:39
Source code size: 336 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 143 / 220
Version history: 5 change(s)
Referenced in: [show references]