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

12
LINES

< > BotCompany Repo | #1032132 // replaceDollarVars_withCustomToString - does not use a tokenizer

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

Libraryless. Click here for Pure Java version (3506L/19K).

sS replaceDollarVars_withCustomToString(IF1<O, S> stringifier, S s, O... params) {
  if (empty(params)) ret s;
  MapSO vars = mapKeys dropDollarPrefix((MapSO) litcimap(params));
  ret replaceDollarVars_dyn(s, var -> {
    O value = vars.get(var);
    ret value == null ?: stringifier.get(value);
  });
}

sS replaceDollarVars_withCustomToString(S s, IF1<O, S> stringifier, O... params) {
  ret replaceDollarVars_withCustomToString(stringifier, s, params);
}

Author comment

Began life as a copy of #1028680

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032132
Snippet name: replaceDollarVars_withCustomToString - does not use a tokenizer
Eternal ID of this version: #1032132/4
Text MD5: 3af0f743736687d9479a05b5e3e3ab2d
Transpilation MD5: ec4809a3192dba554cc938a8d25e4186
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-14 05:51:53
Source code size: 468 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 152 / 212
Version history: 3 change(s)
Referenced in: [show references]