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

8
LINES

< > BotCompany Repo | #1036344 // reformatFloatingPointNumbers

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

Libraryless. Click here for Pure Java version (10069L/55K).

sS reformatFloatingPointNumbers(S s, int decimals default 2) {
  ret regexpReplace(s, "\\b" + regexpForFloatingPointWithoutSign(), 
    matcher -> formatDouble(parseDouble(matcher.group()), decimals));
}

sS reformatFloatingPointNumbers(int decimals, S s) {
  ret reformatFloatingPointNumbers(s, decimals);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036344
Snippet name: reformatFloatingPointNumbers
Eternal ID of this version: #1036344/2
Text MD5: cbb9dce47932625f3ad79c67797e0c97
Transpilation MD5: ecc3db91c86c24d096ae59e9aa48f091
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-15 22:58:55
Source code size: 315 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 74 / 113
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)