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

13
LINES

< > BotCompany Repo | #1027860 // jextractAllIC_any - find multiple patterns

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

Libraryless. Click here for Pure Java version (3124L/20K).

1  
static LS jextractAllIC_any(S s, S... patterns) {
2  
  ret jextractAllIC_any(javaTok(s), patterns);
3  
}
4  
5  
static LS jextractAllIC_any(LS tok, S... patterns) {
6  
  new TreeSet<Pair<Int>> set; // pair(startIndex, endIndex)
7  
  for (S pat : patterns) {
8  
    LS tokPat = javaTok(pat);
9  
    jfind_preprocess(tokPat);
10  
    set.addAll(map(jfindAllIC(tok, tokPat), i -> pair(i, i+l(tokPat)-2)));
11  
  }
12  
  ret mapPairsToList(set, (start, end) -> joinSubList(tok, start, end));
13  
}

Author comment

Began life as a copy of #1027859

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1027860
Snippet name: jextractAllIC_any - find multiple patterns
Eternal ID of this version: #1027860/4
Text MD5: 5a91ae087a0d6e69a23ce23e848f687d
Transpilation MD5: 8fca3a5fbbc277aa79876b5f8f6f6752
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-16 11:55:43
Source code size: 467 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 166 / 238
Version history: 3 change(s)
Referenced in: [show references]