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).

static Set<S> getPlural_specials = litciset("sheep", "fish");

static S getPlural(S s) {
  if (contains(getPlural_specials, s)) ret s;
  if (ewic(s, "y")) ret dropSuffixIgnoreCase("y", s) + "ies";
  if (ewicOneOf(s, "ss", "ch")) ret s + "es";
  if (ewic(s, "s")) ret s;
  ret s + "s";
}

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: 611 / 2082
Version history: 3 change(s)
Referenced in: [show references]