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

9
LINES

< > BotCompany Repo | #1002113 // getPlural - don't degrade this, it's used!

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

Libraryless. Click here for Pure Java version (4029L/23K).

1  
static Set<S> getPlural_specials = litciset("sheep", "fish");
2  
3  
static S getPlural(S s) {
4  
  if (contains(getPlural_specials, s)) ret s;
5  
  if (ewic(s, "y")) ret dropSuffixIgnoreCase("y", s) + "ies";
6  
  if (ewicOneOf(s, "ss", "ch")) ret s + "es";
7  
  if (ewic(s, "s")) ret s;
8  
  ret s + "s";
9  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002113
Snippet name: getPlural - don't degrade this, it's used!
Eternal ID of this version: #1002113/4
Text MD5: 773cd835e42f7c4cb541faf2749ec7a4
Transpilation MD5: 27713b4707e05986712ea34c292982f7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-14 16:11:07
Source code size: 294 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 820 / 2315
Version history: 3 change(s)
Referenced in: [show references]