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

11
LINES

< > BotCompany Repo | #1013107 // smartIndexOfSpacedDash - returns index of dash

JavaX fragment (include)

1  
static int smartIndexOfSpacedDash(L<S> x) {
2  
  ret smartIndexOfSpacedDash(x, 0);
3  
}
4  
5  
static int smartIndexOfSpacedDash(L<S> x, int i) {
6  
  outer: for (i |= 1; i+2 <= l(x); i += 2) {
7  
    if (eq(x.get(i), "-") && nempty(x.get(i-1)) && nempty(x.get(i+1)))
8  
      ret i;
9  
  }
10  
  ret l(x);
11  
}

Author comment

Began life as a copy of #1013104

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: #1013107
Snippet name: smartIndexOfSpacedDash - returns index of dash
Eternal ID of this version: #1013107/5
Text MD5: 605f84e833f04029060730a1544e2953
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-09 13:11:03
Source code size: 290 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 382 / 407
Version history: 4 change(s)
Referenced in: [show references]