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

7
LINES

< > BotCompany Repo | #1028470 // formatDouble_noLeadingZero

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

Libraryless. Click here for Pure Java version (3122L/17K).

sS formatDouble_noLeadingZero(double d, int digits) {
  S s = formatDouble(d, digits);
  if (startsWith(s, "-"))
    ret startsWith(s, "-0.") ? "-." + dropFirst(3, s) : s;
  else
    ret startsWith(s, "0.") ? dropFirst(s) : s;
}

Author comment

Began life as a copy of #1007643

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028470
Snippet name: formatDouble_noLeadingZero
Eternal ID of this version: #1028470/6
Text MD5: 2991b17677c10fc04c425ccad0d11ddc
Transpilation MD5: 0471778f5fbea75fc3a79a6cb9fd49b2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-21 00:29:29
Source code size: 236 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 140 / 241
Version history: 5 change(s)
Referenced in: [show references]