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)

static int smartIndexOfSpacedDash(L<S> x) {
  ret smartIndexOfSpacedDash(x, 0);
}

static int smartIndexOfSpacedDash(L<S> x, int i) {
  outer: for (i |= 1; i+2 <= l(x); i += 2) {
    if (eq(x.get(i), "-") && nempty(x.get(i-1)) && nempty(x.get(i+1)))
      ret i;
  }
  ret l(x);
}

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: 381 / 405
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1013572 - tok_indexOfSimpleArrow - returns first C index