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

14
LINES

< > BotCompany Repo | #1032936 // renderVarsWithoutNulls

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

Libraryless. Click here for Pure Java version (3920L/23K).

1  
// Use like this: renderVars(+x, +y)
2  
// Or like this: renderVars SomeID(+x, +y)
3  
sS mapMethodLike renderVarsWithoutNulls(O... params) {
4  
  new LS l;
5  
  int i = 0;
6  
  if (odd(l(params))) {
7  
    l.add(strOrNull(first(params)));
8  
    ++i;
9  
  }
10  
  for (; i+1 < l(params); i += 2)
11  
    if (params[i] != null && params[i+1] != null)
12  
      l.add(params[i] + "=" + params[i+1]);
13  
  ret trim(joinWithComma(l));
14  
}

Author comment

Began life as a copy of #1010650

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1032936
Snippet name: renderVarsWithoutNulls
Eternal ID of this version: #1032936/1
Text MD5: be1a5598e96876ea378fb0e8c7d79175
Transpilation MD5: b04053bd1e304b9ebf70838e8d8da101
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-11 03:59:49
Source code size: 406 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 157 / 214
Referenced in: [show references]