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

49
LINES

< > BotCompany Repo | #1012632 - n2 - n2(3, "item") => "3 items"

JavaX fragment (include)

1  
static S n2(long l) { ret formatWithThousands(l); }
2  
static S n2(Collection l) { ret n2(l(l)); }
3  
static S n2(Map map) { ret n2(l(map)); }
4  
5  
sS n2(double l, S singular) {
6  
  ret n2(l, singular, singular + "s");
7  
}
8  
9  
sS n2(double l, S singular, S plural) {
10  
  if (fraction(l) == 0)
11  
    ret n2((long) l, singular, plural);
12  
  else
13  
    ret l + " " + plural;
14  
}
15  
16  
static S n2(long l, S singular, S plural) {
17  
  ret n_fancy2(l, singular, plural);
18  
}
19  
20  
static S n2(long l, S singular) {
21  
  ret n_fancy2(l, singular, singular + "s");
22  
}
23  
24  
static S n2(Collection l, S singular) {
25  
  ret n2(l(l), singular);
26  
}
27  
28  
static S n2(Collection l, S singular, S plural) {
29  
  ret n_fancy2(l, singular, plural);
30  
}
31  
32  
static S n2(Map m, S singular, S plural) {
33  
  ret n_fancy2(m, singular, plural);
34  
}
35  
36  
static S n2(Map m, S singular) {
37  
  ret n2(l(m), singular);
38  
}
39  
40  
static S n2(long[] a, S singular) { ret n2(l(a), singular); }
41  
42  
static S n2(O[] a, S singular) { ret n2(l(a), singular); }
43  
static S n2(O[] a, S singular, S plural) { ret n_fancy2(a, singular, plural); }
44  
45  
ifclass MultiSet
46  
  static S n2(MultiSet ms, S singular, S plural) {
47  
    ret n_fancy2(ms, singular, plural);
48  
  }
49  
endif

Author comment

Began life as a copy of #1012450

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1012632
Snippet name: n2 - n2(3, "item") => "3 items"
Eternal ID of this version: #1012632/16
Text MD5: d87224bda37f5f0f5fa1171ccac632b1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-22 06:21:27
Source code size: 1188 bytes / 49 lines
Pitched / IR pitched: No / No
Views / Downloads: 360 / 462
Version history: 15 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1012632 & http://1012632.tinybrain.de