Libraryless. Click here for Pure Java version (3080L/17K).
1 | static S n_fancy2UnlessZero(long l, S singular, S plural) { |
2 | ret l == 0 ? "" : formatWithThousandsSeparator(l) + " " + trim(l == 1 ? singular : plural); |
3 | } |
4 | |
5 | static S n_fancy2UnlessZero(Collection l, S singular, S plural) { |
6 | ret n_fancy2UnlessZero(l(l), singular, plural); |
7 | } |
8 | |
9 | static S n_fancy2UnlessZero(Map m, S singular, S plural) { |
10 | ret n_fancy2UnlessZero(l(m), singular, plural); |
11 | } |
12 | |
13 | static S n_fancy2UnlessZero(O[] a, S singular, S plural) { |
14 | ret n_fancy2UnlessZero(l(a), singular, plural); |
15 | } |
16 | |
17 | ifclass MultiSet |
18 | static S n_fancy2UnlessZero(MultiSet ms, S singular, S plural) { |
19 | ret n_fancy2UnlessZero(l(ms), singular, plural); |
20 | } |
21 | endif |
Began life as a copy of #1012450
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1032116 |
Snippet name: | n_fancy2UnlessZero - takes singular and plural |
Eternal ID of this version: | #1032116/1 |
Text MD5: | 0c8e3f4ea45368595218b0a8a2731b58 |
Transpilation MD5: | 45158b6ded47673b811cb90dd9e3a64c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-14 01:44:52 |
Source code size: | 666 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 151 / 217 |
Referenced in: | [show references] |