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

21
LINES

< > BotCompany Repo | #1022653 // ai_findSpreadOutWords (ignoring case)

JavaX fragment (include)

static L<Int> ai_findSpreadOutWords(LS tok, S... words) {
  ret ai_findSpreadOutWords(tok, wrapAsList(words));
}

static L<Int> ai_findSpreadOutWords(LS tok, LS words) {
  int i = 1, iWord = 0, nWords = l(words), nTok = l(tok);
  new L<Int> indices;
  while (iWord < nWords) {
    if (i >= nTok) null; // fail
    if (eqic(tok.get(i), words.get(iWord))) {
      indices.add(i);
      ++iWord;
    }
    i += 2;
  }
  ret indices;
}

static L<Int> ai_findSpreadOutWords(S s, S... words) {
  ret ai_findSpreadOutWords(javaTok(s), words);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022653
Snippet name: ai_findSpreadOutWords (ignoring case)
Eternal ID of this version: #1022653/5
Text MD5: 3a5f98b8116040c4c937298fdb712421
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-27 15:20:55
Source code size: 557 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 205 / 252
Version history: 4 change(s)
Referenced in: [show references]