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

21
LINES

< > BotCompany Repo | #1011530 // n_fancy - like n(), but with thousands separator

JavaX fragment (include)

static S n_fancy(long l, S name) {
  ret formatWithThousandsSeparator(l) + " " + trim(l == 1 ? singular(name) : getPlural(name));
}

static S n_fancy(Collection l, S name) {
  ret n_fancy(l(l), name);
}

static S n_fancy(Map m, S name) {
  ret n_fancy(l(m), name);
}

static S n_fancy(O[] a, S name) {
  ret n_fancy(l(a), name);
}

ifclass MultiSet
  static S n_fancy(MultiSet ms, S name) {
    ret n_fancy(l(ms), name);
  }
endif

Author comment

Began life as a copy of #1002112

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011530
Snippet name: n_fancy - like n(), but with thousands separator
Eternal ID of this version: #1011530/1
Text MD5: da6a47f9b46132621e51fbabadd8e876
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-30 23:59:12
Source code size: 450 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 346 / 378
Referenced in: [show references]