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

10
LINES

< > BotCompany Repo | #1006240 // nth

JavaX fragment (include)

1  
static S nth(int i) {
2  
  S s = "th";
3  
  int tens = (i % 100)/10;
4  
  if (tens != 1) {
5  
    if ((i % 10) == 1) s = "st";
6  
    if ((i % 10) == 2) s = "nd";
7  
    if ((i % 10) == 3) s = "rd";
8  
  }
9  
  ret i + s;
10  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006240
Snippet name: nth
Eternal ID of this version: #1006240/2
Text MD5: 266e1986fd2339d86f9696d8a933e6eb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-13 22:25:02
Source code size: 208 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 611 / 611
Version history: 1 change(s)
Referenced in: [show references]