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 (2254L/14K).

static L<S> getPlural_specials = ll("sheep", "fish");

static S getPlural(S s) {
  if (containsIgnoreCase(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   

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

No comments. add comment

Snippet ID: #1002113
Snippet name: getPlural - don't degrade this, it's used!
Eternal ID of this version: #1002113/3
Text MD5: f97210911d7ced464a05c8087a586178
Transpilation MD5: ee85b053b1643a495f2e6e4991fbab9a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-23 23:20:30
Source code size: 296 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 473 / 1838
Version history: 2 change(s)
Referenced in: [show references]

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