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

9
LINES

< > BotCompany Repo | #1036327 // withDollar

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

Transpiled version (9711L) is out of date.

1  
// mapLL withDollar("1.23", "+1.23", "-0.12", "abc", null, "", "$1")
2  
sS withDollar(S s) {
3  
  if (empty(s)) ret "";
4  
  if (startsWithOneOf(s, "$", "+$", "-$")) ret s;
5  
  
6  
  int i = 0;
7  
  if (startsWithOneOf(s, "+", "-")) ++i;
8  
  ret insertStringAt(s, i, "$");
9  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036327
Snippet name: withDollar
Eternal ID of this version: #1036327/3
Text MD5: c4ec7837dcba30e4179a37df3bdf30e6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-18 20:55:37
Source code size: 255 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 129 / 182
Version history: 2 change(s)
Referenced in: [show references]