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

21
LINES

< > BotCompany Repo | #1012450 // n_fancy2 - takes singular and plural

JavaX fragment (include)

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

static S n_fancy2(Collection l, S singular, S plural) {
  ret n_fancy2(l(l), singular, plural);
}

static S n_fancy2(Map m, S singular, S plural) {
  ret n_fancy2(l(m), singular, plural);
}

static S n_fancy2(O[] a, S singular, S plural) {
  ret n_fancy2(l(a), singular, plural);
}

ifclass MultiSet
  static S n_fancy2(MultiSet ms, S singular, S plural) {
    ret n_fancy2(l(ms), singular, plural);
  }
endif

Author comment

Began life as a copy of #1011530

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: #1012450
Snippet name: n_fancy2 - takes singular and plural
Eternal ID of this version: #1012450/3
Text MD5: 8ff34de6ad3e92e2b6e5271d13a6fa5c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-03 16:37:39
Source code size: 562 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 546 / 575
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1012632 - n2 - n2(3, "item") => "3 items"
#1014213 - n3 - takes plural from mech list
#1032116 - n_fancy2UnlessZero - takes singular and plural