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

10
LINES

< > BotCompany Repo | #1011321 // swapFirstTwoLongs

JavaX fragment (include)

1  
static S swapFirstTwoLongs(S s) {
2  
  L<S> tok = javaTok(s);
3  
  int i = 1;
4  
  while (i < l(tok) && !isInteger(tok.get(i))) i += 2;
5  
  int j = i+2;
6  
  while (j < l(tok) && !isInteger(tok.get(j))) j += 2;
7  
  if (j >= l(tok)) ret s;
8  
  swapElements(tok, i, j);
9  
  ret join(tok);
10  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011321
Snippet name: swapFirstTwoLongs
Eternal ID of this version: #1011321/1
Text MD5: ac40e9351de6d388554cef54f8656292
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-24 04:04:55
Source code size: 277 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 416 / 420
Referenced in: [show references]