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

14
LINES

< > BotCompany Repo | #1023396 // jfind_any - returns C index. might not be efficient (always tries all the patterns)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5640L/31K).

static int jfind_any(S src, S... patterns) {
  ret jfind_any(javaTok(src), patterns);
}
  
static int jfind_any(LS tok, int startIdx default 1, S... patterns) {
  ret jfind_any(tok, startIdx, null, patterns);
}

static int jfind_any(LS tok, int startIdx default 1, TokCondition cond, S... patterns) {
  int i = -1;
  for (S pat : patterns)
    i = minUnlessMinus1(i, jfind(tok, startIdx, pat, cond));
  ret i;
}

Author comment

Began life as a copy of #1002429

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: #1023396
Snippet name: jfind_any - returns C index. might not be efficient (always tries all the patterns)
Eternal ID of this version: #1023396/6
Text MD5: c54d148af2fa010899fe59872d9a1b85
Transpilation MD5: b57e945111e1720e4ec94fd46fbcdeb5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-08 07:02:52
Source code size: 424 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 306 / 438
Version history: 5 change(s)
Referenced in: [show references]