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.

// mapLL withDollar("1.23", "+1.23", "-0.12", "abc", null, "", "$1")
sS withDollar(S s) {
  if (empty(s)) ret "";
  if (startsWithOneOf(s, "$", "+$", "-$")) ret s;
  
  int i = 0;
  if (startsWithOneOf(s, "+", "-")) ++i;
  ret insertStringAt(s, i, "$");
}

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: 60 / 89
Version history: 2 change(s)
Referenced in: [show references]